pub struct RbacEngine { /* private fields */ }Expand description
RBAC policy engine.
Implementations§
Source§impl RbacEngine
impl RbacEngine
Sourcepub fn remove_role(&self, role_id: &str) -> Result<()>
pub fn remove_role(&self, role_id: &str) -> Result<()>
Remove a role.
Sourcepub fn list_roles(&self) -> Vec<Role>
pub fn list_roles(&self) -> Vec<Role>
List all roles.
Sourcepub fn add_permission(&self, permission: Permission) -> Result<()>
pub fn add_permission(&self, permission: Permission) -> Result<()>
Add a permission.
Sourcepub fn get_permission(&self, permission_id: &str) -> Option<Permission>
pub fn get_permission(&self, permission_id: &str) -> Option<Permission>
Get a permission by ID.
Sourcepub fn assign_role(&self, subject_id: &str, role_id: &str) -> Result<()>
pub fn assign_role(&self, subject_id: &str, role_id: &str) -> Result<()>
Assign a role to a subject.
Sourcepub fn revoke_role(&self, subject_id: &str, role_id: &str) -> Result<()>
pub fn revoke_role(&self, subject_id: &str, role_id: &str) -> Result<()>
Revoke a role from a subject.
Sourcepub fn get_subject_roles(&self, subject_id: &str) -> Vec<String>
pub fn get_subject_roles(&self, subject_id: &str) -> Vec<String>
Get roles assigned to a subject.
Sourcepub fn set_role_inheritance(
&self,
child_role_id: &str,
parent_role_id: &str,
) -> Result<()>
pub fn set_role_inheritance( &self, child_role_id: &str, parent_role_id: &str, ) -> Result<()>
Set role inheritance (child inherits from parent).
Sourcepub fn get_effective_roles(&self, subject_id: &str) -> HashSet<String>
pub fn get_effective_roles(&self, subject_id: &str) -> HashSet<String>
Get all roles for a subject including inherited roles.
Sourcepub fn has_permission(
&self,
subject_id: &str,
action: Action,
resource_type: ResourceType,
) -> bool
pub fn has_permission( &self, subject_id: &str, action: Action, resource_type: ResourceType, ) -> bool
Check if a subject has a specific permission.
Sourcepub fn get_subject_permissions(&self, subject_id: &str) -> Vec<Permission>
pub fn get_subject_permissions(&self, subject_id: &str) -> Vec<Permission>
Get all permissions for a subject.
Sourcepub fn clear_assignments(&self)
pub fn clear_assignments(&self)
Clear all role assignments.
Sourcepub fn clear_roles(&self)
pub fn clear_roles(&self)
Clear all roles.
Sourcepub fn clear_permissions(&self)
pub fn clear_permissions(&self)
Clear all permissions.
Trait Implementations§
Source§impl AccessControlEvaluator for RbacEngine
impl AccessControlEvaluator for RbacEngine
Source§fn evaluate(&self, request: &AccessRequest) -> Result<AccessDecision>
fn evaluate(&self, request: &AccessRequest) -> Result<AccessDecision>
Evaluate an access request.
Auto Trait Implementations§
impl Freeze for RbacEngine
impl !RefUnwindSafe for RbacEngine
impl Send for RbacEngine
impl Sync for RbacEngine
impl Unpin for RbacEngine
impl UnsafeUnpin for RbacEngine
impl !UnwindSafe for RbacEngine
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> 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