# Custom permission ceilings

**Last updated:** 2026-11-25T08:50:47-03:00 (UTC-3)

Give a named console user a smaller, explicit set of actions while preserving the user's existing built-in role and team boundaries. A financial reader can see analytics without seeing keys or providers. A team key rotator can rotate authorized credentials without creating or deleting keys.

A custom role is a **restriction**, not another source of authority. It cannot make a global administrator, add a team membership, authorize inference, bypass a plan or grant an action that the underlying role or team denies. Existing users without a custom binding keep their built-in behavior.

## Enable or stage a policy

```yaml
features:
  console_users: true
  granular_rbac: true
  custom_roles: true
  custom_roles_management: true
custom_roles:
  roles:
    - id: finance_reader
      name: Finance reader
      base_role: viewer
      permissions: [session:read, config:read, analytics:read]
      disabled: false
  bindings: []
```

Both new flags default to `false`. `custom_roles` enables the named user's restrictive authorization profile. `custom_roles_management` enables the administrative API/console writers and requires the UI plus the existing named-user/RBAC foundation. YAML definitions and bindings default to empty lists. No user, credential or infrastructure is provisioned by this configuration.

An administrator can stage definitions and bindings with management enabled and enforcement off. **A bound user is denied while enforcement is off**; the gateway never interprets that state as permission to fall back to the full built-in role. Keep an unbound global recovery administrator available.

Existing restrictive rights continue to apply if a license expires; expiration does not remove a security ceiling. Administrative changes also require the existing license write checks, so a classified expired edition can remain read only. Feature flags do not grant a console permission or select a commercial plan.

## Definition and binding fields

| Field | Meaning and bounds |
| --- | --- |
| `custom_roles.roles[].id` | Stable lowercase identifier, 2–64 bytes, beginning with a letter and continuing with letters, digits, `_` or `-`; built-in role names are reserved |
| `custom_roles.roles[].name` | Trimmed display name, 1–128 UTF-8 bytes, without control characters |
| `custom_roles.roles[].base_role` | `viewer`, `operator`, `user`, `team_viewer` or `team_admin`; must match the bound user's built-in role |
| `custom_roles.roles[].permissions` | Explicit unique catalog entries, at most64; an empty list grants no resource actions |
| `custom_roles.roles[].disabled` | Boolean, default `false` in YAML; the canonical API definition includes it explicitly |
| `custom_roles.bindings[].user_id` | An existing named console user's generated ID; cannot identify the shared recovery administrator |
| `custom_roles.bindings[].role_id` | The chosen role definition ID; the same name in the API (`bindings[].role_id` of `GET /api/v1/admin/custom-roles`, `role_id` of the assignment body) |

At most64 role definitions and500 distinct binding users are supported. The binding bound includes explicit clearing overrides and declared references, not only currently active assignments. Definition IDs, base roles and permission names are case sensitive. Unknown fields, malformed types, duplicate permissions and invalid references are rejected.

To declare a binding, first provision the named user through the normal user-management workflow, obtain its actual ID from **Console users** or `GET /api/v1/admin/users`, then add that ID and `role_id` to the YAML list. A name or e-mail is not a user ID. The gateway validates the referenced user and its built-in ceiling; YAML never creates the identity.

Include `session:read` and `config:read` when the profile needs the console shell. Give only the other actions that the user needs. Turning off an unrelated read permission must not expose its inventory through configuration: the gateway projects configuration fields according to the effective rights. Public compiled schema metadata can be returned as top-level `parameter_catalog` without disclosing applied infrastructure settings.

## Supported permission profile

The administrative catalog returns the exact `permission_catalog`, permitted base roles, action kind and conditional team requirements. Use those entries; do not synthesize permission names from HTTP methods or a `:read` suffix. Some existing console capabilities perform an inference or self-service action, subject to their separate authorization and quotas.

The custom write profile contains qualified key actions and the separately enabled owner-team prompt actions below:

| Permission | Qualified operations |
| --- | --- |
| `keys:create` | Create a managed key within existing team/model/route constraints |
| `keys:rotate` | Immediate rotation, retiring a previous credential, static metadata tags, and the prepared/confirmed scheduled-rotation workflow |
| `keys:revoke` | Revoke an authorized managed key |
| `keys:delete` | Logically delete an authorized managed key |

A scoped action still requires the user's current team administration or an explicitly delegated member action, plus all applicable policies, flags, plans and license checks. Selecting `keys:rotate` alone does not grant creation, deletion, source-policy editing, attribution editing, ownership assignment or permission delegation. `keys:manage`, arbitrary routes and the `content:read` grant are not custom grants. Unqualified operational write families are not offered by this finite catalog.

The key list and credential rotation do not require `teams:read`; when the user cannot list teams, the console shows the admitted team ID instead of its display name. The **console creation form** also needs explicit `teams:read` to obtain the selected team's actual model/route policy. Without it, **Create key** is disabled with that prerequisite shown. Creation does not require key-inventory access: a creator with `teams:read` can open the creation page through `keys:create` while the console labels the key inventory as unavailable to that role. This interface dependency grants nothing implicitly: `keys:create` remains independently enforced by the API, which validates the supplied real team and its policy.

The five [content permissions](/docs/features/access-control/#content-visibility-follows-the-role) are in the catalog like any other read, each only for the base roles that hold it: `content_structure:read` for every base, `content_sent:read`, `content_reasoning:read` and `content_media:read` for `team_admin`, and `content_received:read` for none. So a ceiling withholds a content permission by leaving it out, and can never add one: a `team_admin` ceiling that lists only `content_structure:read` reads the metadata of captured records and no content, and a ceiling that lists none of them reads nothing of captured content, the structural items of a span included. The console lists them with a label that says what each one reads. A `content:read` grant does not raise a ceiling.

Three [review permissions](/docs/features/human-review/#who-may-do-what) are in the catalog for the base roles that hold them: `reviews:annotate` for `user` and `team_admin`, `reviews:assign` for `team_admin`, and `reviews:calibrate` for `viewer` and `team_admin`. A ceiling over `user` that keeps `evals:read` and `reviews:annotate` is a reviewer who works the queues they are named on and manages nothing; add the content permissions a `team_admin` base allows when the reviewer must read the conversation, or give a reader grant. `review_queues:manage` is administration and, like every `:manage` permission, is in no ceiling.

For [delegated prompt management](/docs/features/prompt-delegation/), only `user` and `team_admin` ceilings may include `prompts:write`, `prompts:publish` and `prompts:delete`. Each still needs the explicit owning-team delegation, operational flags, active membership and current plan/license. A `team_viewer` does not gain a prompt writer. Draft save cannot disable, resurrect or withdraw publication; operator-bound revisions remain protected.

Global reader profiles keep their built-in global scope; team/user profiles keep their admitted team scope. A permission ceiling does not convert a global reader into a team role. Create the user with the appropriate built-in scope before binding a profile.

## Console workflow

In **Console users**, use **Custom role ceilings** to create or edit a definition. Choose its built-in ceiling and explicit permissions, then save. Select an existing compatible named user to assign the profile. The interface displays current sources/versions and the enforcement state; server-side checks remain authoritative.

The binding objects of the API and the assignment body use `role_id`, the YAML name (the user and session objects keep `custom_role_id`, the role that applies to them). `PUT` with explicit `null` clears the binding as an administrator's deliberate override. `DELETE` removes the override and restores the declared YAML binding, if any. These actions have different effects: inspect the declared/current state before choosing one.

A conflict preserves a draft only within the same authority. Reload and review before saving again. Known permission loss, a changed identity or a newer publication invalidates stale editing authority and discards one-time access state; restoring a flag alone does not resurrect an old writable response.

## Administrative API

All endpoints below require a built-in global administrator. They use same-origin session/CSRF protection and return no credential, token, hash or session material.

| Endpoint | Behavior |
| --- | --- |
| `GET /api/v1/admin/custom-roles` | Definitions, bindings, finite permissions, limits, sources and edit capability |
| `PUT /api/v1/admin/custom-roles/{id}` | Upsert a complete restrictive definition |
| `DELETE /api/v1/admin/custom-roles/{id}` | Remove the console override or restore its declared definition |
| `PUT /api/v1/admin/users/{id}/custom-role` | Assign `role_id`, or explicitly clear it with `null` |
| `DELETE /api/v1/admin/users/{id}/custom-role` | Revert the binding override to YAML |
| `POST /api/v1/admin/custom-roles/adopt-base` | Adopt the operator's reviewed declared base |

Every writer includes the current global `version` and `expected_base_fingerprint` from the catalog. Binding writers also include the user's current `user_version`. Definition `PUT` supplies a complete `role` with all five definition fields, whose `id` matches the URL. Successful writes return204; fetch fresh versions before another mutation. Use **API access** for complete login and `curl` examples that fetch real IDs and versions.

A malformed request is400, incompatible role/binding422, denied authority403, missing resource/disabled writer404, and stale version/base or a referenced role409. Storage/synchronization failures return503; reload before retrying because a change may have committed. These responses are not interchangeable with a new authorization grant.

## Revocation, declared changes and recovery

Role, state, memberships, binding and role permissions are read from PostgreSQL for each named request. They are not embedded as authoritative grants in a cookie or an optional inference-key cache. Revoking a right affects the existing cookie on the next request, across replicas. A response already admitted/transmitted is not retracted.

Qualified key mutations revalidate the current ceiling under the same locks as the affected write. A writer waiting on a user lock cannot commit using a permission removed before it acquires authority. Scheduled activation checks the actor's current custom rights again when due: withdrawn rights block that job without retiring the current credential. See [key rotation](/docs/features/key-rotation/#scheduled-activation).

The first admitted declared base is persisted. Later YAML drift is visible through fingerprints and requires explicit adoption; removing a binding from a file cannot silently restore built-in privileges before that review. Users potentially bound by the old or new base fail closed while authority is unresolved. A console-null mask is different from malformed or missing persisted authority.

All declared and override references remain protected, including dormant YAML bindings hidden by a console override. A referenced role cannot be deleted or changed incompatibly. Review/adopt the intended YAML change and remove or rebind its users before deleting the remaining definition. Ordinary user/SCIM updates cannot silently clear an incompatible custom restriction.

If a changed YAML file removes a role that a console binding still references, adoption is rejected and the base mismatch blocks ordinary override edits. Restore the last valid YAML base first, restart with that matching base, and repair or clear the affected bindings using current administrative versions. Then reapply the intended YAML change and adopt its reviewed fingerprint. There is no force-adoption option that bypasses references or restores privileges.

For a locked-out named user, use the unbound global administrator, inspect the role/base/binding and restore a valid definition, adopt the reviewed base, or deliberately clear/revert the binding under current administrative checks. Do not edit authority JSON directly or restore an old backup to bypass revocation. A damaged authority state is denied, not treated as an unrestricted user.

## Upgrade

Back up PostgreSQL and apply the custom-role migration through the existing [migration procedure](/docs/operate/operations/). Upgrade every replica before enabling these flags or persisting definitions/bindings; older binaries cannot enforce the new authority profile. Follow the backup/configuration rollback procedure instead of mixing older identity writers.

The accepted built-in OIDC/SAML/SCIM identity contracts remain unchanged: a custom name from an identity-provider claim does not assign a role. Bind the existing local identity explicitly. Inference keys remain governed by their own identity, model/route, team and financial contracts.
