Roles & RBAC
1. Overview & Purpose
What are Roles & RBAC?
2. When to Use Roles Management
Organizational Hierarchy & Role Levels (Rank 1 to 5)
The enterprise establishes formal staff tiers (Rank 1 Cashier, Rank 2 Supervisor, Rank 3 Store Manager, Rank 4 Finance Director, Rank 5 Executive).
Branch Context Mode Partitioning (STRICT vs FULL)
Frontline store cashiers must be locked strictly to their store outlet, whereas regional operations directors require global visibility across all 12 branches.
System Role Immutability & Kernel Protection
A junior IT administrator attempts to delete or rename the root Super Admin role to customize the navigation interface.
Departmental Job Specialization (Warehouse vs Purchasing vs Sales)
Preventing warehouse receiving staff from viewing sales margins, and restricting sales reps from approving purchase order supplier costs.
Read-Only External Auditor & Tax Consultant Role
External financial auditors require access to examine transaction histories and general ledgers without holding any creation or modification authority.
3. Data Dictionary & Fields
Schema structure for the roles authorization table:
| Field / Column | Input Type | Requirement | Description & Operational Guide |
|---|---|---|---|
code | STRING(50) | Required | Unique machine-readable role identifier (e.g. super, admin, cashier, finance). |
name | STRING(50) | Required | Human-readable title displayed on user forms and role badges. |
description | STRING(255) | Optional | Operational summary of responsibilities assigned to this role. |
level | INTEGER | Optional | Hierarchical rank used to govern supervisory delegation and approval boundaries. |
contextMode | STRING(20) | Required | Context scope mode: STRICT locks to user scopes, FULL allows viewing all branches. |
isFullContext | BOOLEAN | Required | Computed boolean derived from contextMode (true when mode is FULL). |
isSystem | BOOLEAN | Required | Protection flag for built-in system roles (super, admin) preventing deletion. |
4. Interface Preview
Role management screen showing system role badges, context modes (STRICT vs FULL), level hierarchies, and edit actions.
Screen Preview: Role Management Console Interface
Visual interface illustration and control layout for menu Route: /admin/user-management/roles
5. Creating a Role
Navigate to Roles Console
Select User Management > Roles from the primary navigation.
Launch Role Creation Dialogue
Click Add Role in the top toolbar to open the specification modal.
Enter Code & Role Name
Provide a unique lowercase code (e.g. store_manager) and display name.
Select Context Mode
Choose STRICT for single-branch store personnel or FULL for HQ executives.
Save Role Profile
Click Submit to persist the role, then proceed to Matrix Permissions to grant access.
6. Context Mode Configuration
Locate Role
Find role row by code or name using the table search bar.
Modify Configuration
Click Edit to adjust display name, description, level rank, or context mode.
Save Updates
Confirm updates. Changes take effect on next token or context refresh.
7. Role Deletion & System Locks
System Role Immutability
System Role Protection
Roles flagged with isSystem = true or code = super cannot be deleted.
8. Cross-Module Impact
| Target Subsystem | Relational & Transactional Effect |
|---|---|
| Matrix Permissions | Every role forms a column in the permission matrix granting or denying specific endpoints. |
| User Accounts | Users inherit their operational capabilities and interface visibility from their role. |
| Branch Context Guard | Dictates whether the user interface displays the branch switcher dropdown or locks to one branch. |
Operational Best Practices
- Create granular roles aligned to actual job titles rather than granting generic admin status.
- Keep contextMode STRICT for cashiers and warehouse attendants to avoid cross-branch stock leakage.