Skip to main content

Module rbac

Module rbac 

Source
Expand description

Role-Based Access Control (RBAC) Foundation.

Provides separation of duties through role-based permissions for SOC2 compliance.

§Overview

This module implements the foundation for RBAC with:

  • Pre-defined roles with appropriate permission sets
  • Fine-grained permissions for all operations
  • Permission checking and enforcement
  • Audit integration for access control events

§Roles

RoleDescriptionKey Permissions
AdminFull system accessAll permissions
OperatorDay-to-day operationsCapture, Recall, Sync, Configure
UserStandard user accessCapture, Recall
AuditorRead-only audit accessViewAudit, GenerateReports
ReadOnlyRead-only data accessRecall only

§Example

use subcog::security::rbac::{Role, Permission, AccessControl};

let ac = AccessControl::new();

// Check if a role has a permission
assert!(ac.has_permission(&Role::Admin, &Permission::Delete));
assert!(!ac.has_permission(&Role::ReadOnly, &Permission::Delete));

// Get all permissions for a role
let user_perms = ac.permissions_for(&Role::User);
assert!(user_perms.contains(&Permission::Capture));

Structs§

AccessControl
Access control manager for checking role permissions.
RbacSummary
Summary of the entire RBAC configuration.
RoleSummary
Summary of a role’s permissions.

Enums§

AccessResult
Result of an access control check.
Permission
Fine-grained permissions for system operations.
PermissionCategory
Categories of permissions for grouping and display.
Role
System roles with predefined permission sets.