Custom Roles
The six built-in roles cover 80% of needs. For the remaining 20% — cross-cutting access patterns, module-specific personas, tenant-specific hierarchies — use custom roles. Compose exactly the permissions you want from the platform's core + module permission set, assign to users.
For basics, see Roles and Permissions.
Anatomy of a custom role#
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | |
- Tenant-scoped. Custom roles live inside a tenant. A super admin could create a shared template, but the role instances are per-tenant.
- Composable. Mix core permissions with module permissions freely. Must be a subset of what the tenant has enabled.
- Additive. Assigning a custom role doesn't revoke built-in role permissions; both stack. User's effective permission set is the union.
Design patterns#
Pattern 1: Read-only specialist#
Most common pattern — give a team read access to something but not write:
1 2 3 4 5 6 7 8 9 10 | |
Support team can look at bots, see conversation histories, search the knowledge base — but can't modify anything. Useful for first-line support who observe but don't configure.
Pattern 2: Domain-scoped power user#
Grant full control over one module, no other admin:
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
The owner of your knowledge base can do anything within ScaiMatrix but can't touch bots, accounting, users, other modules.
Pattern 3: Service account with narrow scope#
For a specific integration's API key — narrow it to exactly what it needs:
1 2 3 4 5 6 | |
Create a user for the service, assign this role, create an API key under that user. The key can read usage; it can't do anything else even if leaked.
Pattern 4: Escalation handler#
Route human-in-the-loop decisions:
1 2 3 4 5 6 7 8 9 10 11 | |
People with this role handle human-in-the-loop tasks queued by agents. They can see what's pending, resolve it, but can't change how agents themselves are configured.
Managing custom roles#
Creating#
1 2 3 4 | |
Validates that all requested permissions exist and that the tenant has the relevant modules enabled.
Listing available permissions#
Before building a role, see what's available:
1 2 | |
Returns core permissions plus permissions from every enabled module, grouped by module. The admin UI has a visual picker built on this.
Assigning to users#
1 2 3 4 5 6 7 | |
A user can have multiple custom roles. Effective permissions = union of all assigned roles + any directly-granted module permissions.
Updating#
1 2 3 4 | |
Changes apply to all users with the role immediately, on their next request.
Deleting#
1 2 | |
Users who had the role lose its permissions. Their built-in roles remain.
Precedence and conflicts#
A user's effective permissions come from:
- Built-in roles (union of permission sets)
- Custom roles (union)
- Direct module permission grants
All three contribute. There's no negation — you can't have a role that revokes a permission. If a user has tenant_user (which includes models:use) plus a custom role without it, they still have models:use.
To restrict a user, give them only what they need — don't try to "subtract" permissions.
Anti-patterns to avoid#
- One role per user. If you're creating a unique role for every user, use direct module permission grants instead — they're per-user by design.
- Mirror of built-in roles. Don't re-create
tenant_adminas a custom role. Use the built-in. - Too many roles, too similar. If you have
analytics-ro,analytics-export,analytics-dashboard, consider whether one role covers all three cases.
Group mappings + custom roles#
Group mappings can target custom roles as well as built-in:
1 2 3 4 5 6 7 8 | |
Users in the ScaiKey group automatically get the custom role on authentication. Remove from the group → auto-revoke (if configured).