RBAC (role-based access control) is an authorization model that assigns permissions to roles and users to roles, instead of granting permissions to users one by one. Good RBAC design in a SaaS panel rests on four basics: roles are defined per tenant, code checks permissions rather than roles, the default answer is "no access," and every request is checked on the server. On its own, RBAC can't express rules like "users can only edit their own records," so most SaaS products add record-level rules alongside roles.
What Is RBAC?
In RBAC, permissions go to roles and roles go to users. According to NIST's RBAC project page (opens in a new tab), role-based access control was formalized in 1992 by David Ferraiolo and Rick Kuhn and became the dominant model for advanced access control by lowering administration costs. NIST's RBAC model was adopted as American National Standard ANSI/INCITS 359-2004 in 2004.
The core idea is simple: instead of saying "Alice can see invoices, Bob can see invoices," you say "the Accounting role can see invoices" and give Alice and Bob that role. When a new accountant joins, all you do is assign them the role.
What Makes RBAC Different in SaaS?
In a single company's internal app, roles are the same for everyone. In SaaS, each tenant has its own users and its own roles. A user can be an admin in one tenant and only a viewer in another. So roles are assigned not to the user but to the user's membership in a tenant.
| Entity | What it holds |
|---|---|
| User | Credentials, email |
| Tenant | The customer organization |
| Membership | Which user is in which tenant, and their role |
| Role | A set of permissions in a tenant: Admin, Editor, Viewer |
| Permission | A single action: invoice.read, invoice.create, user.invite |
There are also two different kinds of admin: the tenant admin who manages their own tenant, and your team who manages the whole platform. These two roles must never be mixed. A tenant admin's authority should never reach outside their own tenant under any circumstances.
Design Principles
Have Code Check Permissions, Not Roles
Checks like if (user.role === "admin") look practical at first. But when a new role is added, many places in the code have to change. Instead, code should check the permission: can(user, "invoice.create"). Which role has which permissions is stored as data, so adding a role or granting a role a permission doesn't require a code change.
Deny by Default
OWASP's authorization cheat sheet (opens in a new tab) stresses that even when no access control rule explicitly matches, the application can't stay neutral, and the default should be to deny. When a new feature is added without a permission defined for it, nobody should be able to reach it.
Least Privilege
The same cheat sheet notes that least privilege must be applied both horizontally and vertically. Vertical means a user can't reach actions above their level, such as a viewer deleting users. Horizontal means a user can't reach the data of another user or tenant at the same level. When designing default roles, give each one only the permissions it needs to do its job.
Check Every Request on the Server
The cheat sheet says permissions should be validated correctly on every request. Hiding a button in the interface isn't authorization; a user can send the same request straight to the API. Broken access control (opens in a new tab) sitting at number one on the OWASP Top 10:2025 shows how common these mistakes are.
Beyond Roles: Record-Level Rules
RBAC says "editors can edit invoices." It can't, on its own, express rules like "editors can only edit drafts they created" or "sales reps can only see their own customers." Those rules require looking at the record itself.
OWASP's authorization cheat sheet makes a clear recommendation here: typically prefer attribute-based (ABAC) and relationship-based (ReBAC) access control over RBAC. In practice, many SaaS products combine them: roles set coarse permissions, and record-level rules look at the user's relationship to the record. For example:
// permissionsOf(role): the role's permission list, loaded once per request.
function canEditInvoice(user, membership, invoice) {
if (invoice.tenantId !== membership.tenantId) return false;
if (!permissionsOf(membership.role).includes("invoice.update")) return false;
if (membership.role === "editor") return invoice.createdBy === user.id && invoice.status === "draft";
return true;
}In this example, roles other than editor can edit any invoice if they have the permission. The first line of the check is tenant separation, and it should always come first. I cover the database side of tenant separation in multi-tenant architecture.
Default and Custom Roles
Most SaaS products start with a few built-in roles: Owner, Admin, Member, Viewer. That's usually enough for the first version. Enterprise customers eventually want to define their own roles. If you stored permissions as data from the start, adding custom roles just means building an admin screen. One thing to watch: a tenant admin shouldn't be able to grant another role a permission they don't have themselves.
Testing Permissions
Permission bugs usually show up as something working that shouldn't. That's why tests that only check a feature works miss them. Draw up a permission table for each role and turn it into automated tests: a viewer can't create an invoice, an editor can't delete users, one tenant's admin can't see another tenant's records. When a new endpoint is added without a permission test, flag it as missing in code review. If permissions are stored as data, the tests can be generated from that data too.
Performance
Checking permissions on every request shouldn't mean reading the user's role and permissions from the database every time. Load membership and permissions once at the start of the request and use them for its duration, or cache them briefly. When a user's role changes, remember to clear the related cache, or a user who lost access may keep working with old permissions for a while.
Audit Log
Record who got which role and when, who invited or removed users and who changed important records. That log is needed both to investigate security incidents and to meet enterprise customers' audit requests. If your support team needs to act inside a customer's account on their behalf, log that separately too and make it visible to the customer.
Common Mistakes
- Checking role names all over the code.
- Enforcing permissions only by hiding buttons in the interface.
- Keeping tenant admins and platform admins in the same role.
- Skipping record-level checks and looking only at the role.
- Leaving a new feature open to everyone by default.
Frequently Asked Questions
Should I Use RBAC or ABAC?
For most SaaS products, a combination. Starting with roles keeps administration simple. When rules like record ownership, department or status are needed, add attribute- and relationship-based checks.
Where Should Permission Checks Happen?
On the server, in a single authorization layer that every endpoint and background job calls. Checks in the interface are only for user experience.
How Many Roles Should There Be?
Few, and easy to understand. Many similar roles confuse users and raise the risk of wrong assignments. Before adding a role, see whether an existing one can be extended.
Can a User Belong to More Than One Tenant?
Yes, and it's common in SaaS. That's why roles should be assigned to memberships, not users, and every request should establish which tenant it's working for. I cover the general framework in how to build a SaaS.
If you'd like to design the role and permission structure of your SaaS panel together, see the SaaS and Microservice Development service or write to me through the contact page.



