pub struct RbacManager { /* private fields */ }Expand description
RBAC Manager — manages roles, permissions, and HitL approvals.
Implementations§
Source§impl RbacManager
impl RbacManager
Sourcepub fn assign_role(&mut self, subject: Subject, role: Role)
pub fn assign_role(&mut self, subject: Subject, role: Role)
Assigns a role to a subject.
Sourcepub fn revoke_role(&mut self, subject: &Subject)
pub fn revoke_role(&mut self, subject: &Subject)
Revokes the role from a subject.
Sourcepub fn get_role(&self, subject: &Subject) -> Option<Role>
pub fn get_role(&self, subject: &Subject) -> Option<Role>
Returns the role assigned to a subject, if any.
Sourcepub fn check_permission(
&mut self,
subject: &Subject,
action: &Action,
resource: &str,
) -> bool
pub fn check_permission( &mut self, subject: &Subject, action: &Action, resource: &str, ) -> bool
Checks whether a subject has permission for the given action on a resource.
Sourcepub fn request_approval(
&mut self,
subject: Subject,
action: Action,
resource: String,
reason: String,
) -> Uuid
pub fn request_approval( &mut self, subject: Subject, action: Action, resource: String, reason: String, ) -> Uuid
Creates a new approval request for a high-risk action.
Sourcepub fn pending_approvals(&self) -> Vec<&PendingApproval>
pub fn pending_approvals(&self) -> Vec<&PendingApproval>
Returns all currently pending approval requests.
Sourcepub fn all_approvals(&self) -> &[(PendingApproval, ApprovalStatus)]
pub fn all_approvals(&self) -> &[(PendingApproval, ApprovalStatus)]
Returns all approval requests (pending + history) with their status.
Sourcepub fn audit_log(&self) -> &[RbacAuditEntry]
pub fn audit_log(&self) -> &[RbacAuditEntry]
Returns the RBAC audit log.
Trait Implementations§
Source§impl Clone for RbacManager
impl Clone for RbacManager
Source§fn clone(&self) -> RbacManager
fn clone(&self) -> RbacManager
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RbacManager
impl Debug for RbacManager
Auto Trait Implementations§
impl Freeze for RbacManager
impl RefUnwindSafe for RbacManager
impl Send for RbacManager
impl Sync for RbacManager
impl Unpin for RbacManager
impl UnsafeUnpin for RbacManager
impl UnwindSafe for RbacManager
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