Concept
Role-Based Access Control
RBAC assigns permissions to roles, then assigns users to those roles. Instead of defining permissions separately for every individual user, the application asks which role the authenticated user has and what that role is permitted to do.
For example:
role: editor
→ permissions: [create_post, edit_own_post]
role: admin
→ permissions: [create_post, edit_any_post, delete_user]This produces a simple permission model:
Editor
→ create posts
→ edit posts they authored
Admin
→ create posts
→ edit any post
→ delete user accountsThe advantage is simplicity. Permissions can be defined once for each role rather than repeatedly for individual users, making the system easier to build, reason about, and audit when the application has a small number of well-defined privilege tiers.
However, RBAC becomes insufficient when authorization depends on context beyond the user's role.
Consider:
Editor → can edit their own posts
Editor → cannot edit another editor's postsBoth requests come from users with exactly the same role:
role = editorThe role alone cannot determine the correct decision. The server also needs to evaluate the relationship between the user and the specific post:
Authenticated user
↓
Role = editor ✓
↓
Requested post
↓
Does this editor own the post?
↓
Allow / deny