pub struct RbacService<S: RbacStorage> { /* private fields */ }
Expand description
Main RBAC service that coordinates permission checking
Implementations§
Source§impl<S: RbacStorage> RbacService<S>
impl<S: RbacStorage> RbacService<S>
Sourcepub async fn create_permission(
&self,
permission: &Permission,
) -> Result<(), RbacError>
pub async fn create_permission( &self, permission: &Permission, ) -> Result<(), RbacError>
Create a new permission
Sourcepub async fn get_permission(
&self,
name: &str,
) -> Result<Option<Permission>, RbacError>
pub async fn get_permission( &self, name: &str, ) -> Result<Option<Permission>, RbacError>
Get a permission by name
Sourcepub async fn assign_permission_to_role(
&self,
permission_name: &str,
role_name: &str,
) -> Result<(), RbacError>
pub async fn assign_permission_to_role( &self, permission_name: &str, role_name: &str, ) -> Result<(), RbacError>
Assign a permission to a role
Sourcepub async fn remove_permission_from_role(
&self,
permission_name: &str,
role_name: &str,
) -> Result<(), RbacError>
pub async fn remove_permission_from_role( &self, permission_name: &str, role_name: &str, ) -> Result<(), RbacError>
Remove a permission from a role
Sourcepub async fn get_permissions_for_role(
&self,
role_name: &str,
) -> Result<Vec<Permission>, RbacError>
pub async fn get_permissions_for_role( &self, role_name: &str, ) -> Result<Vec<Permission>, RbacError>
Get all permissions for a role
Sourcepub async fn assign_role_to_subject(
&self,
role_name: &str,
subject_id: &str,
) -> Result<(), RbacError>
pub async fn assign_role_to_subject( &self, role_name: &str, subject_id: &str, ) -> Result<(), RbacError>
Assign a role to a subject
Sourcepub async fn remove_role_from_subject(
&self,
role_name: &str,
subject_id: &str,
) -> Result<(), RbacError>
pub async fn remove_role_from_subject( &self, role_name: &str, subject_id: &str, ) -> Result<(), RbacError>
Remove a role from a subject
Sourcepub async fn get_roles_for_subject(
&self,
subject_id: &str,
) -> Result<Vec<Role>, RbacError>
pub async fn get_roles_for_subject( &self, subject_id: &str, ) -> Result<Vec<Role>, RbacError>
Get all roles for a subject
Sourcepub async fn assign_permission_to_subject(
&self,
permission_name: &str,
subject_id: &str,
) -> Result<(), RbacError>
pub async fn assign_permission_to_subject( &self, permission_name: &str, subject_id: &str, ) -> Result<(), RbacError>
Assign a permission directly to a subject
Sourcepub async fn remove_permission_from_subject(
&self,
permission_name: &str,
subject_id: &str,
) -> Result<(), RbacError>
pub async fn remove_permission_from_subject( &self, permission_name: &str, subject_id: &str, ) -> Result<(), RbacError>
Remove a permission from a subject
Sourcepub async fn get_direct_permissions_for_subject(
&self,
subject_id: &str,
) -> Result<Vec<Permission>, RbacError>
pub async fn get_direct_permissions_for_subject( &self, subject_id: &str, ) -> Result<Vec<Permission>, RbacError>
Get all direct permissions for a subject (not including those from roles)
Auto Trait Implementations§
impl<S> Freeze for RbacService<S>where
S: Freeze,
impl<S> RefUnwindSafe for RbacService<S>where
S: RefUnwindSafe,
impl<S> Send for RbacService<S>
impl<S> Sync for RbacService<S>
impl<S> Unpin for RbacService<S>where
S: Unpin,
impl<S> UnwindSafe for RbacService<S>where
S: UnwindSafe,
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