pub struct AccessScope<Role> {
pub role: Role,
pub allow_supervisor_access: bool,
}Expand description
Contains information about the granted access scope.
Fields§
§role: RoleThe role attached to the scope.
allow_supervisor_access: boolWhether all supervisors are granted access.
Implementations§
Source§impl<Role> AccessScope<Role>
impl<Role> AccessScope<Role>
Sourcepub fn grants_role(&self, role: &Role) -> bool
pub fn grants_role(&self, role: &Role) -> bool
Returns true if the given role matches the scope.
Sourcepub fn grants_supervisor(&self, role: &Role) -> bool
pub fn grants_supervisor(&self, role: &Role) -> bool
Returns true if the given role is the required role or a supervisor
(higher privilege according to the total ordering) of it.
Ordering contract (enforced by AccessHierarchy marker): Higher privilege > Lower privilege So a supervisor (or same role) satisfies: user_role >= required_role
Sourcepub fn allow_supervisor(self) -> Self
pub fn allow_supervisor(self) -> Self
Allows access to all supervisor of the role of the scope.
Trait Implementations§
Source§impl<Role: Clone> Clone for AccessScope<Role>
impl<Role: Clone> Clone for AccessScope<Role>
Source§fn clone(&self) -> AccessScope<Role>
fn clone(&self) -> AccessScope<Role>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<Role> Freeze for AccessScope<Role>where
Role: Freeze,
impl<Role> RefUnwindSafe for AccessScope<Role>where
Role: RefUnwindSafe,
impl<Role> Send for AccessScope<Role>where
Role: Send,
impl<Role> Sync for AccessScope<Role>where
Role: Sync,
impl<Role> Unpin for AccessScope<Role>where
Role: Unpin,
impl<Role> UnwindSafe for AccessScope<Role>where
Role: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more