My Approach to Flexible Roles and Permissions
← Back to blog

My Approach to Flexible Roles and Permissions

Published on
•
2 mins read
•
--- views

When I build a system, I give particular attention to user rights, roles and security configuration. Over time I have settled on an approach to roles and permissions that is flexible enough to adapt to almost any new system I take on.

The core of the model is hierarchy. There are leaders who sit above other members of a team, and team members who can act on entities inside the team. The set of actions available to each person is different, and that difference is the whole point: a role is not a label, it is a precise answer to "what may this person do, and to which entities".

It comes down to three moving parts kept separate:

  • Identity - who the person is, and which team or organization they belong to.
  • Roles - a named position in the hierarchy, such as admin, manager, or a plain member.
  • Permissions - the concrete actions a role grants, resolved against the specific entities the person can reach.

Keeping those three apart is what makes the model portable. The permissions are expressed as a claim carried on the user's identity, so a request is authorized by reading what the identity already proves rather than by re-deriving it every time. Swap the entity names and the hierarchy depth, and the same structure fits a new domain without a rewrite.

The last screenshot is from how the fit actually gets chosen. Together with the other engineers we got on a call, ran a brainstorm, and picked the authorization strategy best suited to that particular system, weighing its hierarchy and the set of actions each role needed. The model gives the starting shape; the brainstorm tailors it. That pairing is why the same approach keeps working across very different products.

The permissions in detail

The worked-out permission model for the system is below: the roles, the actions each one grants, and how they map to entities.

Projects

Posts

Open for contract collaboration

I am available for contract-based collaboration. If you have an interesting project idea, schedule a call via Calendly.

Schedule a 30-min call