Skip to main content

Guard

Struct Guard 

Source
pub struct Guard { /* private fields */ }
Expand description

Centralized runtime validation for the Trust Model.

Implementations§

Source§

impl Guard

Source

pub fn new(project: &Project) -> Self

Create a Guard from a loaded project (no gates).

Source

pub fn with_gates( project: &Project, gates: BTreeMap<String, GateConfig>, ) -> Self

Create a Guard with gates.

Source

pub fn load(root: &Path) -> Result<Self, JoyError>

Load project.yaml and create a Guard, including gate config.

Source

pub fn gates(&self) -> &BTreeMap<String, GateConfig>

Get the configured gates (for display in joy project).

Source

pub fn check(&self, action: &Action, identity: &Identity) -> Verdict

Check whether an action is allowed for the given identity.

Source

pub fn is_last_manager(&self, member_id: &str) -> bool

Check if removing a member would leave no one with manage capability.

Auto Trait Implementations§

§

impl Freeze for Guard

§

impl RefUnwindSafe for Guard

§

impl Send for Guard

§

impl Sync for Guard

§

impl Unpin for Guard

§

impl UnsafeUnpin for Guard

§

impl UnwindSafe for Guard

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V