Planning roles and permissions in business software
Permissions look like a side issue, yet they are one of the most consequential early decisions. If they are planned too late, they have to be retrofitted across the whole application.
What you will learn
Role and permission are not the same thing
A permission is a single authorisation: viewing orders, approving orders, changing prices. A role bundles permissions into a job profile: case handling, sales, accounting.
The separation is worthwhile as soon as there are more than two groups. Assigning permissions to individual people is quicker at the start and becomes more expensive with every staff change — someone then has to work out which authorisations the departed person had.
Four questions that must be answered
The fourth question has a side effect that is often overlooked: if data is not really deleted, all lists and reports must know that invalid records exist. If this is forgotten in one place, deleted transactions appear in the annual statistics.
Permissions apply on the server, not in the interface
A hidden button is a usability aid, not a safeguard. Anyone who knows the address can still call up the operation. Only the check on the server is binding, and at every single access — including the ones the interface does not offer at all.
This applies particularly to lists with filters: a filter that bypasses the permission check shows, via a URL parameter, data that would never be reachable in the interface. Such places are found almost only in a review or in a test that specifically looks for them.
An example from practice
Delegation — the case that challenges every clean plan
The person responsible is on leave, but the transaction still has to be approved. Three approaches are common, and they differ greatly:
Which approach is right depends on how often the case occurs. What matters is only that it is decided before building — delegation logic added afterwards touches every check point in the application.
Where to start
Not with a permissions matrix of fifty individual permissions. A sensible approach is: name three to five roles, answer the four questions above for each, and write down the special cases instead of solving them immediately.
The special cases are where the real insight lies. If, while writing things down, you notice that a role may do different things in two departments, you model it either as two roles or as one role with a scope, such as the user's own department.
Common misconceptions
About the author
Fabian Lücker is managing partner of PHP-Schmiede KG in Rheine and has worked in software development since 2007. He is responsible for development and design, and writes here about decisions that arise in real projects.