Skip to content
← All work

Work · AI platform for building LLM apps · 2026

Custom roles and single sign-on provisioning for an AI platform

Workspaces had a fixed set of roles. Enterprise customers needed their own, and wanted membership driven by their identity provider.

Role
Design and implementation, end to end
When
2026
Built with
TypeScriptAngularNestJSPostgreSQLRedis

The problem

Every workspace shipped with the same few built-in roles. Larger customers wanted roles that matched their own teams, such as someone who can run evaluations but cannot change deployments.

They also did not want to manage people by hand. Access had to follow the groups they already keep in their identity provider.

Permission checks run on every request, so whatever I built had to be fast, and a mistake could lock a customer out of their own workspace.

From a role to a decision

  1. 01

    Role editor

    Admins compose a role from a catalogue of actions

  2. 02

    Role store

    Roles and assignments saved per workspace

  3. 03

    Snapshot at sign-in

    A member’s roles resolve once into a cached set of permissions

  4. 04

    Check on every request

    Each service reads the snapshot instead of the database

Key decisions

  1. 01

    One catalogue of actions

    Every permission the product understands is listed in one place. The editor, the storage and the enforcement code all read from it, so a new feature cannot ship with a permission the editor does not know about.

  2. 02

    Resolve once, check cheaply

    Roles are expanded into a permission snapshot when a session token is issued. Request-time checks read that snapshot, which keeps them fast.

  3. 03

    Changes apply immediately

    A cached snapshot could leave someone with access they just lost. Each role change bumps a version number, and stale snapshots are rejected and rebuilt on the next request.

  4. 04

    Guard rails before launch

    A workspace can never be left with no administrator, and the whole feature sits behind a flag that is off by default, so it could ship in small reviewable pieces.

  5. 05

    Groups map to roles

    Groups pushed from an identity provider map to custom roles, so adding someone to a group in the company directory grants the right access with no manual step.

Where it landed

  • Shipped as six stacked changes plus a follow-up, each reviewable in isolation.
  • Enforced in both of the platform’s authorisation paths, with a role editor in the workspace settings.
  • Directory group mapping released as a feature preview.

Company names are withheld under confidentiality. Diagrams are redrawn for this site, and I am happy to go into more detail in conversation.