Who can do what-after the app knows who you are.
Who can do what-after the app knows who you are.
Lesson outline
Before any sensitive action (delete file, edit record, call API), the app asks: "Does this user have permission?"
It uses roles (e.g. admin vs viewer), attributes (e.g. department = Sales), or allow/deny rules. Least privilege = give only the minimum access needed. Need read only? Don’t grant write.
Same idea everywhere: AWS IAM, Azure RBAC, Kubernetes RBAC, app-level permissions.
On every sensitive action the app asks: “Does this user have permission?”
Request
Delete file, edit record, call API
Permission check
Does this user have permission?
Allow
Access granted
Deny
403 Forbidden
Grant only the minimum access needed. If someone only needs to read data, don't give them write access. This limits the damage if their account is compromised.
Role = a bundle of permissions. You assign "Editor" instead of "read + write + edit + delete" one by one. Change the role once; everyone with that role gets the update.
Policy = a rule in code. Example: "allow read if user.role is Viewer". Policy languages support conditions, wildcards, and "if user.department = resource.department".
Auth gives you who; roles and policies say what they can do. AWS IAM, Azure RBAC, GCP IAM all work this way.
Group permissions: assign “Editor” instead of dozens of individual rights.
Structured rules with conditions, wildcards, and logic. Easier to manage at scale.
Real systems combine identity from authentication with these rules to allow or deny each request. Same ideas in AWS IAM, Azure RBAC, Kubernetes RBAC.
RBAC = decide by role (e.g. "Editor"). ABAC = decide by attributes: user (department, role), resource (owner, status), environment (time, IP).
Example ABAC rule: "Allow edit if user.department = resource.department AND time is 9–5 AND resource.isFinal is false." More flexible than RBAC, more complex to manage.
Use RBAC for simple "admin vs viewer". Use ABAC when the rule depends on the resource or context (e.g. "only author can edit", "only during business hours").
Example ABAC rule
Allow edit if user.department = resource.department AND time is 9–5 AND resource.isFinal is falseMore flexible than RBAC, more complex to manage.
Assign users to roles (Admin, Editor, Viewer). Decision = role only.
Decision = user + resource + environment (e.g. time, IP).
ACL = permissions on the resource. Each file or object has a list: "Alice: read/write, Bob: read". Common in file systems (Linux chmod) and object storage.
ACLs are simple but don’t scale: change 1000 users = update 1000 ACLs. Roles scale: change the role once, everyone with that role updates.
Many systems use both: roles for broad access, ACLs for per-resource overrides (e.g. "this folder: only these three users").
Permissions attached to each resource. Simple, but changing 1000 users can mean 1000 updates.
Change the role once; everyone with that role gets the update. Scales better.
Many systems use both: roles for broad patterns, ACLs for resource-specific exceptions.
Rule: "Employee can edit this document only if they are the author and the document is not marked Final."
RBAC alone fails: the rule depends on this document (author, isFinal), not just "Editor" role. You need ABAC or a policy engine (e.g. Open Policy Agent) that can check user + resource + flags at runtime.
Same pattern everywhere: approvals, ownership, time windows, status flags → fine-grained "who can do what on which thing".
Decision: RBAC is not enough — you need ABAC or a policy engine.
Edit only if you are the author and document is not Final.
Check user + resource attributes (author, isFinal) at runtime.
e.g. Open Policy Agent — fine-grained rules, ownership, time windows, status flags.
Backend and cloud interviews: expect to design or explain access control (roles, policies, IAM) for an app or cloud account.
Common questions:
Key takeaways
When would you choose ABAC over RBAC?
When the rule depends on the resource or context (e.g. "only the author can edit", "only during business hours") rather than a fixed role.
Related concepts
Explore topics that connect to this one.
Practice with these scenarios
Apply this concept in hands-on scenarios.
Test yourself: 1 challenge
Apply this concept with scenario-based Q&A.
Ready to see how this works in the cloud?
Switch to Career Paths for structured paths (e.g. Developer, DevOps) and provider-specific lessons.
View role-based pathsSign in to track your progress and mark lessons complete.
Questions? Discuss in the community or start a thread below.
Join DiscordSign in to start or join a thread.