pub struct AdvancedPermissionCheck<'a> { /* private fields */ }Expand description
Builder for constructing an advanced permission check with ABAC policies, delegations, and role resolution.
Wraps the six parameters of
PermissionChecker::check_advanced_permission into a self-documenting
builder so callers don’t need to remember parameter order.
§Example
ⓘ
use auth_framework::permissions::*;
let granted = checker.check_advanced(
AdvancedPermissionCheck::new("user_123", &permission, &role_resolver)
.user_attributes(&attrs)
.abac_policy(&policy)
.delegations(&delegations),
);Implementations§
Source§impl<'a> AdvancedPermissionCheck<'a>
impl<'a> AdvancedPermissionCheck<'a>
Sourcepub fn new(
user_id: &'a str,
permission: &'a Permission,
role_resolver: &'a dyn Fn(&str) -> Option<Role>,
) -> Self
pub fn new( user_id: &'a str, permission: &'a Permission, role_resolver: &'a dyn Fn(&str) -> Option<Role>, ) -> Self
Start building an advanced permission check with the required fields.
Sourcepub fn user_attributes(self, attrs: &'a HashMap<String, Value>) -> Self
pub fn user_attributes(self, attrs: &'a HashMap<String, Value>) -> Self
Provide user attributes for ABAC evaluation.
Sourcepub fn abac_policy(self, policy: &'a AbacPolicy) -> Self
pub fn abac_policy(self, policy: &'a AbacPolicy) -> Self
Provide an ABAC policy to evaluate against.
Sourcepub fn delegations(self, delegations: &'a [Delegation]) -> Self
pub fn delegations(self, delegations: &'a [Delegation]) -> Self
Provide active delegations to consider.
Auto Trait Implementations§
impl<'a> Freeze for AdvancedPermissionCheck<'a>
impl<'a> !RefUnwindSafe for AdvancedPermissionCheck<'a>
impl<'a> !Send for AdvancedPermissionCheck<'a>
impl<'a> !Sync for AdvancedPermissionCheck<'a>
impl<'a> Unpin for AdvancedPermissionCheck<'a>
impl<'a> UnsafeUnpin for AdvancedPermissionCheck<'a>
impl<'a> !UnwindSafe for AdvancedPermissionCheck<'a>
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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