Docs menuFeatures

DOCS / FEATURES

Custom roles

On the Scale plan, an organization can define its own roles: a name and a set of permissions, held instead of admin or member. For example, a "Billing" role that can pay the bills but not manage people, or an "Auditor" that only reads the audit log.

The model

A custom role is a row in org_roles: a name (unique per org, whatever the case), an optional description, and permission names from the same list the built-in roles use. A member holding one has role = 'member' and custom_role_id set, and holds exactly the role's permissions, not the member role's. What someone holds either way is an Access (api/src/domain/permission.rs), which orgs::require_permission checks. Handlers didn't change.

  • transfer_ownership, manage_sso, manage_security and delete_org can't be part of a custom role. An org has one owner, and those permissions are what make them that.
  • view_org is added to every role, so a holder can always see the org they belong to.
  • A composite foreign key keeps a member's or an invitation's custom role inside the same org, so another org's role id can't be handed out.
  • An org can have up to 20.
  • A permission added in a later release, such as use_chat for the AI chat, is held by the built-in roles at once but by no existing custom role until someone adds it.

[ full guide ]

The rest of this guide comes with the repo.

  • Nobody widens their own access
  • Taking access away is always safe
  • Endpoints
  • In the SPA
  • Tests
Get LaunchCrate