Module core

Source
Expand description

Core role system implementation.

This module contains the main implementation of the role-based access control system. It provides the central RoleSystem struct which manages roles, permissions, subjects, and resources, along with all access control operations.

§Architecture

The role system is built around these key components:

  • Roles: Named entities with assigned permissions
  • Permissions: Grant access to perform actions on resource types
  • Subjects: Users, services, or other entities that are assigned roles
  • Resources: Objects that are protected by permissions
  • Storage: Backend for persisting roles and other entities

§Thread Safety

The implementation uses DashMap for concurrent access to internal data structures, making it thread-safe for use in multi-threaded applications.

§Caching

Permission checks are cached to improve performance for repeated access checks, with configurable cache TTL and invalidation on role changes.

Structs§

PermissionSummary
Summary of a subject’s permissions and roles.
RoleSystem
The main role-based access control system.
RoleSystemConfig
Configuration for the role system.
UserPermissions
Cached permissions for a user with last updated timestamp.

Enums§

AccessResult
The result of an access check.