4 min read

Stop asking who the owner is: in our new access model, no role is special

Almost every product has a line like this somewhere:

if (user.isOwner) {
  showSettings()
}

It reads well and is easy to write. In an access system with custom roles, it’s wrong.

Why “is owner” breaks

In our new access model, a role is just a set of permissions. “Organization owner” is only one of them. A customer can make a custom role with the exact same permissions. They can call it “Platform admin” and give it to their platform team.

Now the check above hides settings from people allowed to change them. The permission system says yes. The page says no. The customer files a support ticket that’s hard to explain. The reverse is worse. A check granting owners something extra hands out access the permission system never recorded.

So our team set a rule for every organization on the new model. No role gets special behavior. Nothing branches on holding a particular role. A page that shows settings asks the question it actually means: “can this person change organization settings?” It lets the permission system answer.

What about lockout?

Preventing lockout was the one place a special role seemed necessary. Someone always has to be able to fix access.

That protection lives on a group, not a role. Every organization has an admin group that can’t be emptied. That break-glass always works, no matter what any role is called or what it contains.

A rule people have to remember is a rule people forget

It’s easy to agree with the rule. It’s just as easy to break it. Owner checks live in muscle memory and in old code people copy. Coding agents produce them too when they pattern-match on the codebase. So we didn’t stop at writing it down.

A person with an empty dashed thought bubble labelled remember, next to a robot with a tick labelled the build

The fastest review comment is the one the build already made.

The rules have limits, though. The backend rule, for example, can’t see a role compared inside the same module that defines it. That case still needs a human eye. We wrote that down right next to the rule.

The habit behind it

This came out of a pattern I’ve started taking seriously. When a reviewer catches the same mistake twice, a constraint is missing. Fix it the first time. The second time, ask whether a lint rule, a test or a type could have caught it. Add that instead of another comment.

A person pointing at a bug that runs into a barrier with a tick, labelled twice and lint rule

It works especially well with coding agents. An agent that keeps writing owner checks isn’t being careless. It’s copying what it sees. Correcting it in every review doesn’t scale. A failing build teaches both the agent and every person the same thing in the same second.

If you have roles in your product

A person holding a key up to a door labelled settings, with the label can they above the person

It’s the same idea as keeping permissions dumb and the hints smart. The model stays simple and predictable. Everything around it does the helping.