pub struct RbacManager { /* private fields */ }Expand description
Role-Based Access Control (RBAC) implementation
Implementations§
Source§impl RbacManager
impl RbacManager
Sourcepub fn create_user(
&mut self,
username: String,
email: String,
security_level: SecurityLevel,
) -> Result<String>
pub fn create_user( &mut self, username: String, email: String, security_level: SecurityLevel, ) -> Result<String>
Create a new user
Sourcepub fn assign_role_to_user(
&mut self,
user_id: &str,
role_id: &str,
) -> Result<()>
pub fn assign_role_to_user( &mut self, user_id: &str, role_id: &str, ) -> Result<()>
Assign role to user
Sourcepub fn create_role(
&mut self,
name: String,
description: String,
) -> Result<String>
pub fn create_role( &mut self, name: String, description: String, ) -> Result<String>
Create role
Sourcepub fn assign_permission_to_role(
&mut self,
role_id: &str,
permission_id: &str,
) -> Result<()>
pub fn assign_permission_to_role( &mut self, role_id: &str, permission_id: &str, ) -> Result<()>
Assign permission to role
Sourcepub fn authenticate(
&mut self,
username: &str,
password: &str,
ip_address: Option<String>,
) -> Result<String>
pub fn authenticate( &mut self, username: &str, password: &str, ip_address: Option<String>, ) -> Result<String>
Authenticate user and create session
Sourcepub fn check_access(
&mut self,
token: &str,
resource: &str,
action: &str,
context: Option<HashMap<String, String>>,
) -> AccessDecision
pub fn check_access( &mut self, token: &str, resource: &str, action: &str, context: Option<HashMap<String, String>>, ) -> AccessDecision
Check access permission
Sourcepub fn get_effective_permissions(
&self,
user_id: &str,
) -> Result<HashSet<String>>
pub fn get_effective_permissions( &self, user_id: &str, ) -> Result<HashSet<String>>
Get effective permissions for user (including hierarchy)
Sourcepub fn get_audit_trail(&self, limit: Option<usize>) -> Vec<&AuditEntry>
pub fn get_audit_trail(&self, limit: Option<usize>) -> Vec<&AuditEntry>
Get audit trail
Sourcepub fn revoke_session(&mut self, token: &str) -> Result<()>
pub fn revoke_session(&mut self, token: &str) -> Result<()>
Revoke session
Sourcepub fn cleanup_expired_sessions(&mut self)
pub fn cleanup_expired_sessions(&mut self)
Clean up expired sessions
Sourcepub fn get_system_stats(&self) -> HashMap<String, Value>
pub fn get_system_stats(&self) -> HashMap<String, Value>
Get system statistics
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RbacManager
impl RefUnwindSafe for RbacManager
impl Send for RbacManager
impl Sync for RbacManager
impl Unpin 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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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