pub struct RoleHierarchy { /* private fields */ }Expand description
A role hierarchy system for managing role inheritance.
Implementations§
Source§impl RoleHierarchy
impl RoleHierarchy
Sourcepub fn set_parent(&mut self, child_id: &str, parent_id: &str) -> Result<()>
pub fn set_parent(&mut self, child_id: &str, parent_id: &str) -> Result<()>
Set a parent-child relationship between roles.
Sourcepub fn get_parent(&self, role_id: &str) -> Option<&Role>
pub fn get_parent(&self, role_id: &str) -> Option<&Role>
Get the parent role of a given role.
Sourcepub fn get_children(&self, role_id: &str) -> Vec<&Role>
pub fn get_children(&self, role_id: &str) -> Vec<&Role>
Get all child roles of a given role.
Sourcepub fn get_ancestors(&self, role_id: &str) -> Vec<&Role>
pub fn get_ancestors(&self, role_id: &str) -> Vec<&Role>
Get all ancestor roles (parents, grandparents, etc.) of a given role.
Sourcepub fn get_effective_permissions(&self, role_id: &str) -> Result<PermissionSet>
pub fn get_effective_permissions(&self, role_id: &str) -> Result<PermissionSet>
Get all permissions for a role, including inherited permissions.
Sourcepub fn has_permission(
&self,
role_id: &str,
action: &str,
resource: &str,
context: &HashMap<String, String>,
) -> Result<bool>
pub fn has_permission( &self, role_id: &str, action: &str, resource: &str, context: &HashMap<String, String>, ) -> Result<bool>
Check if a role has a specific permission, including inherited permissions.
Sourcepub fn get_all_roles(&self) -> Vec<&Role>
pub fn get_all_roles(&self) -> Vec<&Role>
Get all roles in the hierarchy.
Sourcepub fn remove_role(&mut self, role_id: &str) -> Result<()>
pub fn remove_role(&mut self, role_id: &str) -> Result<()>
Remove a role from the hierarchy.
Trait Implementations§
Source§impl Clone for RoleHierarchy
impl Clone for RoleHierarchy
Source§fn clone(&self) -> RoleHierarchy
fn clone(&self) -> RoleHierarchy
Returns a duplicate of the value. Read more
1.0.0 · 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 RoleHierarchy
impl Debug for RoleHierarchy
Auto Trait Implementations§
impl Freeze for RoleHierarchy
impl !RefUnwindSafe for RoleHierarchy
impl Send for RoleHierarchy
impl Sync for RoleHierarchy
impl Unpin for RoleHierarchy
impl !UnwindSafe for RoleHierarchy
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