How to Design Authorisation for Multi-Role Systems

Designing and testing role, tenant and object-level authorisation in business systems where administrators, staff, customers and drivers share the same data.

The short answer

In a multi-role system, access is decided by three layers, not one question; the user’s role, the organisation or company they belong to, and the record they are asking for.

The most common and most costly mistake is checking the role but not object ownership; someone with the customer role can open another customer’s record by changing its identifier.

Authorisation rules belong in one central place, deny by default and run on every request; which routes are open to whom should be written in a matrix, and that matrix verified by automated tests.

Authorisation in a multi-role system answers three questions together: which role does the user have, which organisation or company do they belong to, and is the record they are asking for one they are actually allowed to reach? Systems that ask only the first question are open to one of the most common security defects there is.

This article describes how authorisation is layered in business applications where roles such as administrators, operations staff, customers and drivers share one database, where the rules should live, and how to test them. The examples come from design decisions in the logistics management platform and the Ders Alanı education platform I built; no source code or infrastructure detail is included.

Why it matters so much

OWASP’s 2025 list again puts Broken Access Control in first place, noting that every application tested had some form of it. In a business application with a customer portal, the concrete meaning is plain: one customer being able to see another customer’s shipment, quote or invoice. This defect rarely needs a sophisticated attack; changing a number in the address bar is often enough.

Three layers: role, tenant, object

Layer The question it asks Logistics example Education example
Role May this user do this kind of work? A driver can update a shipment’s status but not see prices A teacher can create an exam; a student cannot
Tenant (organisation or company) May this user reach this organisation’s data? A customer sees only their own company’s shipments A teacher sees only their own institution’s students
Object May this user reach this record? A driver opens only shipments assigned to them A teacher sees only their own class’s report cards

Role-based access control (RBAC), as defined by NIST, covers the first layer: permissions are granted to roles, and roles to users. The tenant and object layers look at attributes of the record; attribute-based access control (ABAC), described in NIST SP 800-162, decides based on attributes of the user, the resource and the environment. OWASP’s authorisation guidance likewise recommends attribute- or relationship-based models over relying on roles alone when business rules are complex.

In practice the two are combined. In Ders Alanı, access is checked against role, institution and class or teacher relationship together; a user whose role is “teacher” still cannot read a student from another institution. In the logistics platform, permissions are scoped by role and company; on the CRM side, checks run in order through session, view, role and company or object ownership.

The costliest mistake: forgetting object ownership

OWASP’s IDOR (insecure direct object reference) guidance describes the situation: the application finds a record using an identifier supplied by the user, but never checks whether the record belongs to that user. The role check passed, the user really is a “customer”; they are simply opening the wrong customer’s record.

Two recommendations from that guidance are decisive. First, unguessable identifiers such as GUIDs make the attack harder but do not replace access control. Second, wherever possible, look the record up within the user’s scope: not “fetch the shipment with this ID” but “fetch the shipment with this ID from this customer’s shipments”.

The representative pseudocode below shows the difference:

# Weak: the record is found first, ownership is never asked
shipment = shipments.find(id)

# Strong: the record is looked up within the user's scope
shipment = shipments.find(id, company = user.company)
if not shipment: return 404

In the second form, another company’s record is simply “not found”; unauthorised access ends without even revealing that the record exists.

Where the rules should live

OWASP’s authorisation guidance highlights three principles: deny by default, validate permissions on every request, and decide in a central place. In a business application, that means:

  1. Deny by default. When a new route or screen is added, nobody can reach it unless someone has explicitly written who may. A forgotten check then becomes a closed door, not an open one.
  2. Check on every request. Being authorised at sign-in does not mean being authorised five minutes later; the user’s role may have changed, or they may have left the company.
  3. Decide centrally. If every screen writes its own check, one day someone will forget. On the CRM side of the logistics platform, quote access goes through one central middleware; screens do not each re-implement the decision.
  4. Decide on the server. Hiding a button is usability, not security. The real decision is made in the API.

The authorisation matrix: writing the rule down

The simplest tool for making authorisation testable is a matrix: routes or actions in the rows, roles in the columns, and “allow”, “deny” or “own records only” in each cell. In the logistics platform, such a matrix is documented for every route.

Action Administrator Operations Customer Driver
View the shipment list All All Own company only Assigned only
Update shipment status Allow Allow Deny Assigned only
View prices and invoices Allow Allow Own company only Deny
Manage users and roles Allow Deny Deny Deny

This table is a representative example; a real matrix is much longer and follows each system’s business rules. Its value is that the rule sits in one readable place instead of being scattered through the code. When a new action is added, the first question becomes “which row of the matrix?”.

Testing authorisation

Once the matrix exists, tests verify it. An effective authorisation test suite contains two kinds of scenario:

  • Positive scenarios: can each role do what it is allowed to do?
  • Negative scenarios: is each role blocked from what it is not allowed to do? In particular, is a user from one tenant refused when they try to open another tenant’s record by its identifier?

Negative scenarios are the more valuable, because that is where vulnerabilities live. In Ders Alanı, scenarios such as reading a student from another institution are covered by 403/404 tests, and access to a lesson is checked separately from access to its recording. In the logistics platform, the access matrix is verified by tests.

Authorisation gaps seen most often

  • Checking only the role. The system asks “is this a customer?” but never “which customer?”.
  • Protecting list and detail screens with different rules. The list is filtered correctly, but the detail page can be opened directly by its identifier.
  • Forgetting files and media. If delivery photos, signed documents or lesson recordings are served through permanent public links, screen-level authorisation stops meaning anything. In Ders Alanı, recordings live in a private bucket and play only through short-lived signed links issued after an access check.
  • Skipping checks in bulk actions. Single updates are protected, but “update selected” does not check ownership of every record in the list.
  • Not recording authorisation decisions. If nobody records who tried to reach what and was refused, nothing can be investigated after the fact. The details are in audit logs and traceability.

Deny by default, check on every request

Authorisation in multi-role systems is the role, tenant and object layers working together. Applying the rules in one central place, denying by default and checking on every request, writing every route into an authorisation matrix, and verifying that matrix with tests weighted towards negative scenarios is the strongest defence against the most common class of security defect. The same principles apply to tool-calling AI assistants: an assistant should never hold more permission than the person using it. That topic is covered in AI agents in business software.

Frequently asked questions

What is the difference between RBAC and ABAC?
RBAC (role-based access control) ties permissions to a user’s role. ABAC (attribute-based access control) decides based on attributes of the user, the resource and the environment, such as which company a record belongs to. Multi-role business systems usually combine the two.
Is making record identifiers unguessable enough?
No. OWASP notes that unguessable identifiers such as GUIDs make attacks harder but do not replace access control. The user’s right to each record still has to be checked.
Should unauthorised access return 403 or 404?
Either can work. 404 avoids revealing that the record exists at all; 403 is clearer when the user knows the record but lacks permission. What matters is that the choice is consistent and covered by tests.
Does hiding a button in the interface count as authorisation?
No. Shaping the interface is a usability measure; the real decision is made on the server, on every request. Someone calling the API directly never sees the interface.

Sources

  1. OWASP Top 10:2025, A01 Broken Access Control owasp.org
  2. OWASP Authorization Cheat Sheet cheatsheetseries.owasp.org
  3. OWASP Insecure Direct Object Reference Prevention Cheat Sheet cheatsheetseries.owasp.org
  4. NIST, Role Based Access Control csrc.nist.gov
  5. NIST SP 800-162, Guide to Attribute Based Access Control (ABAC) csrc.nist.gov

Projects this article draws on