pub struct RbacEnforcer { /* private fields */ }Expand description
In-memory RBAC enforcer.
Reconstructed from WAL events at bootstrap via role assignment and capability grant/revoke calls.
Implementations§
Source§impl RbacEnforcer
impl RbacEnforcer
Sourcepub fn assign_role(
&mut self,
actor_id: ActorId,
role: Role,
tenant_id: TenantId,
)
pub fn assign_role( &mut self, actor_id: ActorId, role: Role, tenant_id: TenantId, )
Assigns a role to an actor within a tenant.
Sourcepub fn grant_capability(
&mut self,
actor_id: ActorId,
capability: Capability,
tenant_id: TenantId,
)
pub fn grant_capability( &mut self, actor_id: ActorId, capability: Capability, tenant_id: TenantId, )
Grants a capability to an actor within a tenant.
Sourcepub fn revoke_capability(
&mut self,
actor_id: ActorId,
capability: &Capability,
tenant_id: TenantId,
)
pub fn revoke_capability( &mut self, actor_id: ActorId, capability: &Capability, tenant_id: TenantId, )
Revokes a capability from an actor within a tenant.
Sourcepub fn has_capability(
&self,
actor_id: ActorId,
capability: &Capability,
tenant_id: TenantId,
) -> bool
pub fn has_capability( &self, actor_id: ActorId, capability: &Capability, tenant_id: TenantId, ) -> bool
Returns true if the actor has the given capability in the tenant.
Sourcepub fn role_of(&self, actor_id: ActorId, tenant_id: TenantId) -> Option<&Role>
pub fn role_of(&self, actor_id: ActorId, tenant_id: TenantId) -> Option<&Role>
Returns the role assigned to an actor in a tenant, if any.
Sourcepub fn check_permission(
&self,
actor_id: ActorId,
capability: &Capability,
tenant_id: TenantId,
) -> Result<(), RbacError>
pub fn check_permission( &self, actor_id: ActorId, capability: &Capability, tenant_id: TenantId, ) -> Result<(), RbacError>
Returns Ok(()) if the actor has the capability, Err(RbacError) otherwise.
Trait Implementations§
Source§impl Default for RbacEnforcer
impl Default for RbacEnforcer
Source§fn default() -> RbacEnforcer
fn default() -> RbacEnforcer
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for RbacEnforcer
impl RefUnwindSafe for RbacEnforcer
impl Send for RbacEnforcer
impl Sync for RbacEnforcer
impl Unpin for RbacEnforcer
impl UnsafeUnpin for RbacEnforcer
impl UnwindSafe for RbacEnforcer
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