Customers want per-project roles rather than one global role. How do you model that, and where in the request does the check happen?
Answer
Short answer
Model permission as a relationship between a subject, a role and a specific resource, not as a role stamped on the user, and push the check down into the data access predicate so a list query and a single-record fetch are authorised by the same rule.
This is authorisation modelling, and RBAC is only one possible shape. Good authorisation starts with the domain action, then decides whether RBAC roles, relationship-based checks, policy rules, or resource ownership should decide access. Weak RBAC designs put every exception into a new role until nobody knows what a role means. Strong authorisation keeps RBAC readable and puts the final check close to the resource being protected.
Was this answer helpful?
Likely follow-ups
- A user is removed from a project while holding a valid access token. When do they stop seeing its data?
- How would you let a support engineer act as a customer without handing them the customer's credentials?
- Where do you put the decision when a permission depends on the record's own state, such as an invoice being locked after approval?
- How do you test authorisation, given that the bug is always an absence rather than a presence?
Related questions
- A maintenance script updates your permissions table and every user in one tenant can suddenly edit everything. What should have stopped that, and how would you have found out?hardAlso on authorisation and multi-tenancy6 min
- A customer reports seeing another company's records in your admin console. Walk me through the first hour, and then tell me what you change so this class of bug cannot happen again.hardAlso on multi-tenancy4 min
- One tenant bursts to ten times their normal traffic and every other customer's latency doubles. Your global rate limit was never hit. How would you design for fairness instead?hardAlso on multi-tenancy5 min
- Walk me through what happens between a customer tapping a card and the merchant getting paid.hardAlso on authorisation6 min