pub struct EnvironmentPermissionChecker { /* private fields */ }Expand description
Environment permission checker
Checks if a user has permission to perform an action in a specific environment, considering both base permissions and environment-specific policies.
Implementations§
Source§impl EnvironmentPermissionChecker
impl EnvironmentPermissionChecker
Sourcepub fn add_policy(&mut self, policy: EnvironmentPermissionPolicy)
pub fn add_policy(&mut self, policy: EnvironmentPermissionPolicy)
Add a policy
Sourcepub fn has_permission(
&self,
role: &str,
permission: Permission,
environment: MockEnvironmentName,
) -> bool
pub fn has_permission( &self, role: &str, permission: Permission, environment: MockEnvironmentName, ) -> bool
Check if a role has permission in an environment
Returns true if:
- There’s no environment-specific policy (fallback to base permission check)
- There’s a policy and the role is allowed
Sourcepub fn get_policies_for_environment(
&self,
environment: MockEnvironmentName,
) -> Vec<&EnvironmentPermissionPolicy>
pub fn get_policies_for_environment( &self, environment: MockEnvironmentName, ) -> Vec<&EnvironmentPermissionPolicy>
Get policies for an environment
Sourcepub fn get_policies_for_permission(
&self,
permission: Permission,
) -> Vec<&EnvironmentPermissionPolicy>
pub fn get_policies_for_permission( &self, permission: Permission, ) -> Vec<&EnvironmentPermissionPolicy>
Get policies for a permission across all environments
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EnvironmentPermissionChecker
impl RefUnwindSafe for EnvironmentPermissionChecker
impl Send for EnvironmentPermissionChecker
impl Sync for EnvironmentPermissionChecker
impl Unpin for EnvironmentPermissionChecker
impl UnwindSafe for EnvironmentPermissionChecker
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> 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