Permissions and roles
A permission is one right, such as “cancel an order”. A role is a named bundle of permissions, such as “order dispatcher”. Principals are given roles, never loose permissions. This page covers how both are named, who may define and hand them out, and why the rules are as strict as they are.
Permissions have four segments
Section titled “Permissions have four segments”A permission is a string of four colon-separated segments:
<application>:<context>:<resource>:<action>- The platform’s own permissions start with
platform, for exampleplatform:messaging:dispatch-job:vieworplatform:iam:user:create. There are about two hundred, listed in the permissions catalogue. - An application’s permissions start with its code, for example
orders:sales:order:cancel.
Any segment of a held permission may be *. A role holding platform:messaging:*:* satisfies
every messaging check, and platform:*:*:* is the super-admin wildcard. A wildcard matches only a
permission with the same number of segments, which is one reason the four-segment shape matters.
Segments use letters, digits, _, . and -, with no spaces; anything else is refused with
INVALID_PERMISSION.
The first segment is not decoration. It names the application the permission belongs to, and the confinement rule below is built on it.
Permissions live on roles. Applications have no separate permission store: their permissions exist as the strings on the roles that grant them, and they reach the platform when the roles do.
Roles are named application:role
Section titled “Roles are named application:role”A role’s canonical name is its application’s code, a colon, and a short name: orders:dispatcher,
platform:admin. The name says who owns the role. Malformed names (spaces, control characters,
look-alike Unicode) are refused with INVALID_ROLE_NAME, never silently trimmed, because a repaired
name would no longer be the string the caller sent or the one in the audit trail.
Roles come from three places, recorded as the role’s source:
| Source | Where it comes from | Who changes it |
|---|---|---|
CODE |
Built into the platform (platform:admin, platform:client-admin, platform:developer, platform:application-service, …) |
Platform releases |
SDK |
An application’s own code, through role sync | The application, on deploy |
DATABASE |
Created by an administrator in the console | Administrators |
The built-in roles are listed in the reference.
Roles synced from code
Section titled “Roles synced from code”An application declares its roles, and the permissions each holds, in its own code and syncs them on
deploy. In the Laravel SDK that is #[AsPermission] and #[AsRole] classes; the other SDKs and the
frameworks have equivalents (define permissions in code).
#[AsPermission(context: 'sales', aggregate: 'order', action: 'cancel', description: 'Cancel orders')]class CancelOrders {} // becomes orders:sales:order:cancel
#[AsRole(name: 'dispatcher', displayName: 'Dispatcher', permissions: [CancelOrders::class])]class DispatcherRole {} // becomes orders:dispatcherRole sync (POST /api/applications/{appCode}/roles/sync) makes the platform match the code:
- Names are lower-cased and given the application prefix.
- Only roles that came from sync are created, updated or removed. A role an administrator made in the console with the same name is left alone.
- With
removeUnlisted, roles the code no longer declares are removed, but a role that is still assigned to someone is not: the sync is refused (ROLE_HAS_ASSIGNMENTS) rather than silently stripping people’s access. - The sync is all or nothing. One refused role rejects the whole payload and nothing is written.
Why from code. The application’s authorization checks and the roles that satisfy them change together, in one commit, reviewed together. A role that exists only in a console is a role that is missing in the next environment.
Confinement: a role holds only its own application’s permissions
Section titled “Confinement: a role holds only its own application’s permissions”A role may hold only permissions whose first segment is its own application’s code. orders:dispatcher
may hold orders:… permissions and nothing else. An attempt to add another application’s permission
is refused with PERMISSION_OUTSIDE_APPLICATION.
This is what stops an application’s credential from minting platform authority: syncing
orders:admin with platform:*:*:* is refused. Role sync never crosses applications, whoever calls
it. Only a super-admin, through the admin API, can put another application’s permission on a role,
and the crossing is logged.
The ceiling: nobody hands out authority they do not hold
Section titled “The ceiling: nobody hands out authority they do not hold”On top of confinement, every change that hands out platform authority is bounded by the caller’s own:
- To add a role to someone, or remove one from them, the caller must hold every platform permission
in that role (
ROLE_ABOVE_CALLER). Removal counts, so a lesser administrator cannot strip a super-admin. - To add a platform permission to a role, or remove one, the caller must hold that permission
(
PERMISSION_ABOVE_CALLER). Otherwise the role rule would be one edit away: addplatform:*:*:*to a role you already have.
Only the change is checked, so an administrator can still edit someone who holds more than they do, as long as they do not touch the roles above them. Application permissions are outside the ceiling: nobody outside an application holds its permissions, and counting them would stop every administrator assigning application roles.
Assigning roles
Section titled “Assigning roles”Assigning a role that does not exist is refused, not stored. An unknown name used to be stored
silently and grant nothing, so a typo showed up weeks later as missing access. When an application
syncs its users (/api/applications/{appCode}/principals/sync), a name that is not a role is not
assigned and is listed back in skippedRoles; a role of another application refuses the whole sync
(ROLE_APP_FORBIDDEN).
Role assignments also arrive from an organisation’s identity provider at sign-in, filtered by an allow list (sign-in and federation).
Delegation to client administrators
Section titled “Delegation to client administrators”A client can run its own user management. The built-in platform:client-admin role lets a user
create, update and deactivate users and assign roles, confined by reach to
their own client:
- They can manage only users homed at a client they reach, and create only client-tier users.
- They can assign any role of any application their client is entitled to, even ones they do not hold themselves.
- They can never assign a platform role (
PLATFORM_ROLE_FORBIDDEN) or a role of an application their client does not use (ROLE_APP_FORBIDDEN). - They can never change anyone’s tier, home client or client grants.
- Resetting a user’s second factors (and sending a password reset that clears them) needs its own permission,
platform:iam:user:reset-2fa, whichplatform:client-adminandplatform:iam-adminhold. Holdinguser:updateis not enough; a role that helduser:updatewhen the permission was introduced was granted it by a migration, so existing custom roles keep working.
Delegation therefore never crosses tenants and never hands out platform authority.
Users with no role see only their profile
Section titled “Users with no role see only their profile”A user can authenticate without having been given anything: someone created just in time by single
sign-on, or an administrator whose roles were removed. Such a user, with no roles and no
permissions, may reach only their own profile: the /auth/* routes (their session, password,
second factors and passkeys), the portal plane’s sign-in routes and GET /api/me. Every other route
answers 403 NO_PLATFORM_ROLE.
The rule is enforced once, in middleware in front of every authenticated route, not in each handler.
Checking it handler by handler left gaps. Service accounts are exempt; an application’s service
account is authorized by its role and its applications claim.
Checking permissions in an application
Section titled “Checking permissions in an application”An application gets a person’s roles from the id_token, and a caller’s granted permissions from an
API access token’s scope claim (or from /api/me). The SDKs check permissions with the same
wildcard matching the platform uses, for example in Laravel:
$user->hasPermissionTo('orders:sales:order:cancel');See tokens for which token carries what.