pub struct RbacAuthorizer { /* private fields */ }Expand description
Role-based authorizer backed by a role -> permissions map.
Implementations§
Source§impl RbacAuthorizer
impl RbacAuthorizer
Sourcepub fn with_role_permission(self, role: &str, permission: &str) -> Self
pub fn with_role_permission(self, role: &str, permission: &str) -> Self
Grants permission to role. Returns self for chaining.
Sourcepub fn revoke(&mut self, role: &str, permission: &str)
pub fn revoke(&mut self, role: &str, permission: &str)
Revokes permission from role if present.
Sourcepub fn role_has_permission(&self, role: &str, permission: &str) -> bool
pub fn role_has_permission(&self, role: &str, permission: &str) -> bool
Returns true if role has been granted permission (or the wildcard).
Sourcepub fn permissions_for_role(&self, role: &str) -> Vec<String>
pub fn permissions_for_role(&self, role: &str) -> Vec<String>
Returns all permissions currently attached to role.
Trait Implementations§
Source§impl Authorizer for RbacAuthorizer
impl Authorizer for RbacAuthorizer
Auto Trait Implementations§
impl Freeze for RbacAuthorizer
impl RefUnwindSafe for RbacAuthorizer
impl Send for RbacAuthorizer
impl Sync for RbacAuthorizer
impl Unpin for RbacAuthorizer
impl UnsafeUnpin for RbacAuthorizer
impl UnwindSafe for RbacAuthorizer
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