Expand description
Permission and role-based access control (RBAC)
This module provides a generic RBAC system using traits. Modules can implement these traits with their own domain entities.
§Generic Design
Instead of hardcoded entity structs, this module uses traits:
PermissionLike- Any type representing a permissionRoleLike- Any type representing a role with permissionsPermissionChecker- Trait for checking permissions
§Usage
ⓘ
// Module implements traits for its domain entities
impl PermissionLike for MyPermission {
fn name(&self) -> &str { &self.name }
fn resource(&self) -> &str { &self.resource }
fn action(&self) -> &str { &self.action }
}Structs§
- InMemory
Permission Service - In-memory permission service for testing and simple use cases
- Simple
Permission - Simple permission for default RBAC implementation
- Simple
Role - Simple role for default RBAC implementation
Traits§
- Permission
Checker - Trait for checking permissions
- Permission
Like - Trait for permission-like types
- Role
Like - Trait for role-like types
Type Aliases§
- Permission
- Type alias for backwards compatibility
- Permission
Service - Type alias for backwards compatibility
- Role
- Type alias for backwards compatibility