Give permissions to roles, then give roles to people.
RBAC (Role-Based Access Control) gives permissions to roles, and then gives roles to people. Nobody gets permissions one by one.
Every system must answer one question many times a day: is this person allowed to do this action? This is authorization. Without a plan, teams give rights to each person directly. That works for 5 people, but with 500 people nobody can say who can do what.
RBAC adds one layer in the middle. The model has three parts: users, roles and permissions. A user holds one or more roles. A role holds a set of permissions. When a user does something, the system collects the permissions of all their roles and checks if the action is in that set.
Two ideas keep RBAC healthy. Least privilege means a person gets only the permissions needed for the job, nothing extra. Deny by default means that if no role allows an action, the answer is no.
| Part | What it is | Example |
|---|---|---|
| User / subject | The person or service asking to do something | alice@company.com, a billing service |
| Role | A named set of permissions for a job | Editor, Approver, Admin |
| Permission | One allowed action on one kind of thing | payment:approve, report:read |
| Assignment | The link between a user and a role | Alice has Editor |
| Session | The roles that are active right now for a login | Alice logged in as Editor |
In a hierarchy, a senior role inherits everything from a junior role. If Editor inherits Viewer, then an Editor can also read. This saves repeating permissions, but a long chain can give more than you meant, so keep it short.
| Model | Decides by | Good for | Weak point |
|---|---|---|---|
| ACL (access control list) | A list on each item: who may touch it | A few items with different owners (files) | Hard to see the whole picture across many items |
| RBAC | The roles of the user | Jobs that are the same for many people | Role explosion when rules get detailed |
| ABAC (attribute-based) | Rules over attributes: user, item, time, place | Fine rules such as 'managers see only their own region' | Rules are harder to read and test |
| ReBAC (relationship-based) | Relationships: 'owner of', 'member of' | Sharing, folders, social apps | Needs a graph of relations |
Flat: each role gives only its own permissions, nothing more.
A small teaching model with made-up roles and permissions. Real systems have many more, and the counts above are illustrative: with direct grants each person needs every permission one by one, with roles each person needs one assignment.
| Term | Meaning in easy words |
|---|---|
| Authorization | Deciding what an already known user is allowed to do |
| Role | A named bundle of permissions that matches a job |
| Permission | One allowed action on one kind of resource |
| Assignment | Giving a role to a user |
| Least privilege | Give only the permissions the job needs, and no more |
| Deny by default | If nothing allows an action, the answer is no |
| Role hierarchy | A senior role inherits the permissions of a junior role |
| Separation of duties | No single person can finish a risky task alone (for example create and approve a payment) |
| Role explosion | So many narrow roles that nobody can manage them |
| ABAC | Attribute-based access control: rules over user, item and context attributes |
| ACL | Access control list: a list on a resource saying who may use it |
| Choice | We gain | We lose |
|---|---|---|
| Few broad roles | Simple to manage | People get more than they need |
| Many narrow roles | Tight least privilege | Hard to manage, role explosion |
| Role hierarchy | Less repeating of permissions | Harder to see the full set, easy to over-grant |
| Roles plus attribute rules | Fine control on top of simple roles | More rules to write and test |
| Check at one gateway | One place to enforce | Services trust the gateway, deeper checks can be missed |
| Check inside every service | Defence in depth | Rules can drift between services |
if role == "admin" checks are hard to change and easy to miss.