# Role-based access control

> Giving permissions to job roles, then putting people in roles, instead of one by one.

- Level: Intermediate
- Topics: Security, Software
- URL: https://tidbit.legios.com.ar/role-based-access-control/
- In Spanish: [Control de acceso basado en roles](https://tidbit.legios.com.ar/es/role-based-access-control/)

**Role-based access control**, or RBAC, organizes who can do what around roles that mirror jobs: "nurse", "billing", "admin", "read-only auditor". Permissions (read patient charts, issue refunds, delete users) are attached to the role, and people are assigned one or more roles. When Ana joins billing, she gets the billing role and instantly has exactly what her colleagues have. When she moves to another team, swapping the role removes the old access.

The alternative, granting permissions person by person, works for five employees and turns into chaos at five hundred. People pile up access as they change jobs, nobody remembers why someone can export the customer database, and audits become archaeology. RBAC makes the question "who can touch payroll?" answerable by looking at one role. It also makes least privilege practical: each role gets only what that job needs.

You meet RBAC everywhere: the "Viewer", "Editor" and "Owner" levels in a shared document, admin consoles in business software, Kubernetes roles, and cloud permission systems like IAM. NIST published a reference model in the early 2000s that became a standard. Its weak spot is rigidity: when rules depend on context ("only patients in your own ward, only during your shift") teams either create dozens of nearly identical roles or move to attribute-based access control (ABAC), which decides using properties of the user, the resource and the moment.

## An analogy

A hotel key card system. The front desk does not program each door for each employee: it gives a card the "housekeeping" profile, which opens guest rooms, or the "maintenance" profile, which opens the boiler room. Change the profile and the card changes with it.

## Keep in mind

- Permissions go to roles; people get roles.
- Changing jobs means swapping roles, not editing dozens of grants.
- It makes least privilege and audits manageable.
- When rules depend on context, ABAC is the usual next step.

## Go deeper

- [Role-based access control on Wikipedia](https://en.wikipedia.org/wiki/Role-based_access_control)
- [Role Based Access Control project (NIST)](https://csrc.nist.gov/projects/role-based-access-control)
- [Authorization Cheat Sheet (OWASP)](https://cheatsheetseries.owasp.org/cheatsheets/Authorization_Cheat_Sheet.html)

## Related terms

- [Database](https://tidbit.legios.com.ar/database/): An organized store of data that programs can search and update safely.
- [Zero trust](https://tidbit.legios.com.ar/zero-trust/): Security that checks every request, instead of trusting whatever is inside the network.
- [Kubernetes](https://tidbit.legios.com.ar/kubernetes/): The system that runs and babysits containers across many machines.
- [Cloud computing](https://tidbit.legios.com.ar/cloud-computing/): Renting computers over the internet instead of buying your own.
- [IAM](https://tidbit.legios.com.ar/iam/): The rulebook that says who can do what in your AWS account.
