Insights · Nov 6, 2026 · 4 min read · FAQ

Roles and permissions in a SaaS app: how to design them safely

Start from a list of actions, group them into a few roles per workspace, and check every request on the server. Here is how we design SaaS permissions.

SAAS PERMISSIONSWho can do what in your app SELLWRIGHT

Sooner or later a customer asks for it: an admin who can invite the team, a finance contact who only sees invoices, a client who can look but not touch. If your app answers with an isAdmin flag and checks scattered through the code, every new request is another place to get it wrong. Broken access control is A01, the top risk, in the OWASP Top 10:2025, and OWASP reports that 100% of the applications tested for that edition had some form of it.

Should you start with roles or with permissions?

Start with permissions. Write down every action a person can take in your product as a verb on a thing: project:read, member:invite, billing:manage, workspace:delete. OWASP's Authorization Cheat Sheet describes the same design exercise: list the types of user, the resources and the operations, then decide what each combination allows.

Then group the permissions into roles. Customers choose roles; your code checks permissions. A new role later is a new grouping of permissions that already exist, not a hunt through every role === "admin" in the codebase.

Which roles does a typical SaaS need?

Four roles cover most products at launch, each named for a responsibility, not seniority.

  • Owner: one per workspace. Holds billing, ownership transfer and deleting the workspace, plus everything an admin can do.
  • Admin: manages members, invites and settings, but not billing or the owner.
  • Member: does the daily work, creating and editing records.
  • Viewer: reads, perhaps comments. Useful for clients, auditors and approvers.

Keep the role on the membership, not the user. A membership links one person, one workspace and one role, so a consultant can be an admin in their own workspace and a viewer in a client's. In AgencyPilotHQ, our own Next.js SaaS, the owner, admin or member role sits on each agency membership rather than on the user account. And resist a role per request: OWASP notes that testing and auditing get harder as roles multiply.

Where should permission checks run?

On the server, in one function that every route, server action and background job calls, and that denies anything not explicitly allowed. OWASP asks for deny by default and for permissions to be validated on every request, because one missed check is enough.

const ROLE_PERMISSIONS = {
  viewer: ["project:read"],
  member: ["project:read", "project:edit"],
  admin:  ["project:read", "project:edit", "member:invite"],
  owner:  ["project:read", "project:edit", "member:invite", "billing:manage"],
} as const;

// Server only: every route, server action and job calls this
async function authorize(userId, workspaceId, permission) {
  const m = await db.membership.findUnique({ where: { userId_workspaceId: { userId, workspaceId } } });
  if (!m || !ROLE_PERMISSIONS[m.role].includes(permission)) {
    await audit.log({ userId, workspaceId, permission, outcome: "denied" });
    throw new ForbiddenError(); // deny by default
  }
}

// Then load the record inside that workspace, never by id alone
const project = await db.project.findFirst({ where: { id, workspaceId } });

The role check is only half of it. Load the record inside the current workspace, never by id alone, or a member can change an id in the URL and read another customer's project. OWASP calls this an insecure direct object reference. Where roles are too coarse, such as only the author editing a draft, add that attribute or relationship rule inside the same function. OWASP goes further: it says attribute-based and relationship-based access control should typically be preferred over pure roles, which handle object-level decisions poorly.

Should the interface hide what people can't do?

Yes, but only as a courtesy. Share the permission map with the front end so a viewer never sees an Edit button that will fail. OWASP says client-side checks may help the experience but must never decide access; one of its Top 10 scenarios bypasses a JavaScript-only check by calling the admin URL with curl. The Next.js docs agree: treat every Server Action and Route Handler like a public API endpoint and verify the user inside it.

Which actions need extra protection?

The ones that change who controls the account or its money. We give each its own permission and add rules around it:

  • Ownership transfer: only by the current owner, only to an existing member, after re-entering a password or second factor. OWASP recommends re-authentication before high-risk actions such as changing payment details.
  • The last owner cannot leave, be removed or be demoted, and the server refuses it, not just the interface.
  • Admins cannot grant a role above their own or change the owner's.
  • Invites carry a fixed role and expire.
  • Billing, exports and bulk deletes each get their own permission, so you can give a finance contact billing access without making them an admin.

What should you log and test?

Log every denied request and every admin action. OWASP's Logging Cheat Sheet lists authorization failures, user administration such as adding users or changing privileges, and data exports among the events to log wherever possible. Record who acted, in which workspace, what changed and when, and keep passwords and access tokens out of it. The Top 10 adds alerting admins when failures repeat.

Then test every role against every permission. A table works well: roles down the side, permissions across, the expected allow or deny in every cell, run on every change. Add cross-workspace cases, where a user of one workspace asks for another's record and gets nothing back.

Where to start

Write your product's actions on one page, mark which role gets each, and look hard at the ones only an owner should have. Then build the central check before the next feature. Our web app and SaaS development service designs roles alongside the data model, and keeping each customer's data separate covers the tenant layer underneath.

FAQ

Frequently asked questions

Should customers be able to create their own custom roles?

Only once your permission list has settled, and usually for larger customers who ask for it. A custom role is just another grouping of the same permissions, so the server check does not change. The risk sits in the role editor: stop anyone granting permissions they do not hold themselves, keep owner-only permissions off the list, and log every change.

Which HTTP status should a denied request return?

Return 401 when the request has no valid sign-in, and 403 when the user is signed in but lacks the permission. MDN describes 403 as a refusal where authenticating again makes no difference. It also notes that a server may send 404 instead of 403 to avoid confirming a resource exists, which suits records that belong to another workspace.

How should our own support team get into customer accounts?

Through a separate, logged path, not by adding staff to the customer's member list. Keep platform staff flags apart from customer roles, make support access time-limited and visible to the workspace owner, and record everything done with it. OWASP's Logging Cheat Sheet lists access by application administrators, including all their actions, among the events to log.

Do we need ABAC or ReBAC from day one?

Usually not as a separate system. Roles plus a few ownership or assignment rules inside the same check function are often enough at launch, and that is already attribute and relationship logic. OWASP generally prefers those models because pure roles handle object-level decisions poorly. Consider a dedicated policy engine when sharing rules multiply, such as per-record sharing with outside guests.

Should API keys have roles too?

Yes. Treat each key as belonging to one workspace, with its own short list of permissions from the same map, rather than inheriting the full role of the person who created it. Show who created each key and when it was last used, let admins revoke keys, and run every API request through the same server-side check as the app.

How often should we review who has admin access?

On a regular schedule, and whenever someone leaves. OWASP recommends periodically reviewing permissions after launch for privilege creep, where users hold more access than the design intended. For your customers, a members screen that shows each person's role and last activity lets the workspace owner run that review themselves.

Next step

Ready for a website that sells?

Book a short call. We will look at your current site, agree what matters most and send a written scope with a fixed quote.

Book a callOr write to hello@sellwrightstudio.com