Mastering RBAC: From Basic Models to Advanced Permission Architectures

This article explains the fundamentals of permission management, detailing the classic RBAC0 model and its extensions RBAC1‑RBAC3, and explores how roles, users, groups, organizations, and positions interrelate in both single‑system and distributed micro‑service architectures, including practical table designs and framework options.

Code Ape Tech Column
Code Ape Tech Column
Code Ape Tech Column
Mastering RBAC: From Basic Models to Advanced Permission Architectures

Permission Model Overview

Permission management controls access to resources in backend systems. The most widely used design is Role‑Based Access Control (RBAC). RBAC0 defines three core entities—users, roles, permissions—with many‑to‑many relationships between users‑roles and roles‑permissions.

RBAC0 diagram
RBAC0 diagram

Users are subjects (internal staff or external customers). Roles act as bridges linking users to permissions, allowing a user to inherit multiple permissions through multiple roles. Direct user‑permission assignment is feasible only for small user bases; otherwise roles are required.

RBAC1 – Hierarchical Roles

RBAC1 adds role inheritance. Roles can inherit permissions from parent roles. Both unrestricted multiple inheritance and restricted single‑inheritance (tree) structures are supported.

RBAC1 diagram
RBAC1 diagram

RBAC2 – Separation‑of‑Duty Constraints

RBAC2 introduces static and dynamic constraints to enforce separation of duties.

Mutually exclusive roles : a user can be assigned at most one role from a conflicting set.

Cardinality constraints : limits on number of users per role, roles per user, or permissions per role.

Prerequisite roles : a higher‑level role can be granted only after the user holds a lower‑level role.

RBAC3 – Comprehensive Model

RBAC3 combines RBAC0, RBAC1, and RBAC2, providing a full‑featured permission architecture.

User Groups, Organizations, and Positions

When the number of users and roles grows, grouping users with similar attributes simplifies administration. Assigning a role to a group automatically grants that role to all members.

Hierarchical groups : parent‑child relationships mirroring organizational structures.

Flat groups : groups without hierarchy, useful for cross‑department collaborations.

Organizations (departments) can be linked to roles. When a user joins an organization, they inherit all roles associated with that organization, reducing manual assignment.

Organization diagram
Organization diagram

Positions within a department (e.g., director, accountant, cashier) have distinct permission sets; higher‑level positions inherit more permissions.

Position diagram
Position diagram

Combined Model

Integrating users, roles, permissions, groups, organizations, and positions yields a flexible architecture suitable for both simple and complex systems.

Combined model diagram
Combined model diagram

Authorization Process

Authorization can be performed manually or via an approval workflow.

Manual authorization : administrators assign roles to users (or users to roles) through the permission‑center UI.

Approval authorization : users request a role through an OA process; a manager approves the request and the role is granted automatically.

Database Schema

A typical relational schema includes tables for users, roles, permissions, user_role, role_permission, groups, organizations, positions, and their association tables. The diagram below shows a simplified multi‑system schema.

Table schema diagram
Table schema diagram

Implementation Frameworks (Java)

Common Java frameworks for implementing RBAC are Apache Shiro and Spring Security. The choice depends on project requirements such as simplicity, feature set, and integration needs.

Conclusion

RBAC provides a stable foundation for permission systems. Extensions such as hierarchical roles, separation‑of‑duty constraints, user groups, organizations, and positions allow the model to scale to large, distributed environments.

Code example

文章有帮助的话,在看,转发吧。
谢谢支持哟 (*^__^*
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Microservicesaccess controlpermission managementAuthorizationRBACBackend Security
Code Ape Tech Column
Written by

Code Ape Tech Column

Former Ant Group P8 engineer, pure technologist, sharing full‑stack Java, job interview and career advice through a column. Site: java-family.cn

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.