Roles and permissions: designing access for staff and clients
Design access by listing who needs to do what, grouping it into a few roles, and checking every request on the server. RBAC, its limits and the pitfalls.
By Sohail Hussain21 November 20265 min read
Design access in three moves. List who needs to see and do what. Group those needs into a small number of roles. Then add a second rule for which records each person can reach, such as "only their own company's orders" or "only jobs in their branch". Enforce both on the server, for every request, deny anything not explicitly allowed, and log what people do. Roles answer "what can this kind of user do?" Scope answers "on which records?" Most access bugs come from forgetting the second question.
Access design is part of every portal and internal tool we build through our client portals and internal tools service. It is one of the decisions that is cheap to get right at the start and painful to retrofit, as custom software vs off-the-shelf notes.
What is role-based access control?
Role-based access control, or RBAC, groups permissions into roles and assigns people to roles, rather than granting permissions to individuals one at a time. When someone joins, you give them a role. When the rules change, you change the role, and everyone in it changes together.
The clearest way to design and document it is a matrix. Here is one for a typical order-management tool with a client portal:
| Action | Admin | Manager | Staff | Client admin | Client user |
|---|---|---|---|---|---|
| View orders | All | All | Assigned to them | Own company | Own company |
| Edit orders | Yes | Yes | Assigned to them | No | No |
| Approve discounts | Yes | Yes | No | No | No |
| See cost and margin | Yes | Yes | No | No | No |
| Export data | Yes | Yes | No | Own company | No |
| Manage users | All | Their team | No | Own company | No |
This table is the specification, the documentation and, later, the test plan. Notice that the cells are not just yes or no. "Assigned to them" and "own company" are scope rules, and they matter as much as the roles.
How do you design roles for your business?
- List the things and the actions. Things: orders, jobs, invoices, documents, users, settings. Actions: view, create, edit, approve, delete, export.
- Talk to real people. Ask three or four of them what they do in a week and what they should never be able to do. Job titles are not roles; two "coordinators" may do quite different work.
- Group the needs into four to six roles. If two groups differ by one permission, consider whether they really need separate roles.
- Write the scope rules separately. Own company, own branch, assigned to me, created by me.
- Name the exceptions and handle them deliberately, with a single extra permission or an approval step, rather than a new role for each one.
- Decide who can grant access. Usually admins for staff, and client admins for their own colleagues.
Why are roles not enough on their own?
Because two clients have the same role and must see completely different data. A client user at Company A and a client user at Company B have identical permissions and no overlap in what they may see. That separation comes from scope, not roles; for software sold to many customers, it is the core of multi-tenant SaaS architecture.
This is why the OWASP Authorization Cheat Sheet recommends preferring attribute- and relationship-based rules over pure RBAC. Attribute rules compare properties: the user's branch matches the record's branch, the discount is under the user's approval limit. Relationship rules follow links: the user is a member of this project, the contact belongs to this company.
In practice, most business tools need roles plus a handful of such rules, not a policy engine. Field-level rules belong in the same design: cost prices, margins, salaries and personal data are often visible to some roles in a record and hidden from others.
Where do permission systems usually go wrong?
Broken access control is first in the OWASP Top 10:2025, and OWASP reports that every application tested for it had some form of the problem. The usual causes:
- Checks only in the interface. Hiding a button does not stop someone sending the request directly. The server must check every time.
- Allowed by default. A new screen or API endpoint is open until someone remembers to lock it. Deny by default instead.
- Guessable IDs without ownership checks. Changing
/orders/5512to/orders/5513should return "not found", not someone else's order. - Side doors. Exports, search, reports, file links and mobile app endpoints that skip the rules the main screens follow.
- Role sprawl. Thirty roles nobody understands, so people get admin rights "to make it work".
- Leavers. Accounts nobody disabled and logins shared between staff.
How should staff and client access differ?
| Staff | Clients | |
|---|---|---|
| Sign-in | Company Google or Microsoft account | Invitation, then a sign-in link or password |
| Two-factor | Required | Offered, required for client admins |
| Who manages accounts | Your admins | Their own client admin |
| When someone leaves | Disabled centrally with their company account | Removed by the client admin |
| What they see | By role and branch | Only their own company's records |
Two more things matter. When support staff need to see what a client sees, give them a logged, time-limited "view as" feature rather than asking for the client's password. And keep an audit log for both groups: who viewed, changed or exported what, and when. For the sign-in technology itself, authentication options for web apps compares the common choices, and client portal: what it is and what to include covers the wider portal design.
How do you test and maintain permissions?
Turn the matrix into automated tests. One test per role and action, run on every change. OWASP lists unit and integration tests for authorisation logic among its core recommendations.
Run the two-account test. Sign in as two different clients side by side and try to reach one's records from the other, by changing IDs, editing requests and opening exported files.
Check tokens. If your app keeps roles inside a signed token such as a JWT, a role change only takes effect when the token is renewed, so keep lifetimes short. Our JWT decoder shows what a token actually carries.
Review access every quarter. Export the list of users and roles, remove leavers and downgrade anyone with more access than their work needs.
Log refused requests. A burst of "access denied" from one account is worth a look.
To start, draw the matrix for your own tool on one page, with real people's names under each role. Gaps and overlaps show up within minutes, and the page becomes the brief for whoever builds or audits the system.
Was this guide useful?