Roles page
The Roles page manages custom roles. A custom role starts from a built-in base role, then grants permissions that open routes the base role would refuse and denies permissions that close routes it would allow. Denials always win. Anything the role does not mention follows the base role, not the user's own Global Proxy Role, and custom roles never restrict proxy admins. You assign a custom role to a person from the Internal Users page. The page lives at /ui/roles and sits under ACCESS CONTROL in the left nav as Roles. The nav item shows only for the session roles Admin (proxy_admin) and Admin Viewer (the view-only proxy_admin_viewer).
The page needs the custom_roles license feature. A short loading state shows while the license is checked. Without the feature it shows "Custom roles needs a Spanway Enterprise license", names the missing feature as "Custom roles", and links to a trial license. The gateway enforces the same feature on every /role route, so the page cannot work without it even if the UI check is skipped.
A real-world scenario
The support desk needs to look up keys and users and block a leaked key, but must never see provider credentials. The admin creates a support-engineer custom role on top of the internal viewer role, grants key and user reads plus key writes, denies credentials, and assigns it to the support engineers.
Steps
-
Open Roles under Access Control, or go to
/ui/roles, and click + Create Role. -
Name the role, pick the base role, set each permission to Grant or Deny (leave the rest on Inherit), and click Create Role. The same with the API:
curl -X POST http://localhost:4000/role/new \-H "Authorization: Bearer $SPANWAY_MASTER_KEY" -H "Content-Type: application/json" \-d '{"role_name": "support-engineer", "base_role": "internal_user_viewer", "permissions": ["keys.read", "keys.write", "users.read"], "denied_permissions": ["credentials.read", "credentials.write"]}' -
Assign the role to a user from the Internal Users page, or with
POST /role/assign.
Expected result
"Role created successfully" shows, and a user with the role can block a key but gets 403 on the credentials routes.
Role list
A line at the top explains what a custom role is. + Create Role shows on the right for a proxy admin (session role Admin).
The table sorts and pages in the browser, 25 rows per page, sorted by role name by default. It has no search box or filters.
| Column | Meaning |
|---|---|
| Role | The role name, with the role ID under it. Sortable. |
| Base Role | The built-in role it starts from, such as Internal User. Sortable. |
| Granted | How many permissions the role grants, or "Everything (*)" when it grants every permission. |
| Denied | How many permissions the role denies. |
| Assigned Users | How many users hold the role. Shows "…" until the count loads. |
| Description | The description, or "-". |
| Created | The creation date. Sortable. |
| Actions | A row menu with Edit and Delete, shown to a proxy admin. |
Edit opens the role in the role dialog. Delete opens Delete Role? with the role name, role ID and assigned user count, and the warning "Users holding this role fall back to their Global Proxy Role. This action cannot be undone." Confirming deletes the role and shows a toast naming it. Every user who held it loses the role at once and is decided by their own Global Proxy Role again, each of them gets an audit row, and the role cannot be restored.
Create Role and Edit Role dialog
The dialog is titled Create Role, or Edit Role followed by the role name, with the line "Grant or deny individual permissions on top of a built-in base role." It loads the permission catalogue from the gateway first, and shows a spinner while it does.
| Field | Type | What it does |
|---|---|---|
| Role Name | Text box | Required ("Please enter a role name"). Placeholder "e.g. Key Auditor". Up to 128 characters, and the name must be unique. |
| Description | Text area | Optional. Placeholder "What this role is for". |
| Base Role | Dropdown | Required ("Please choose a base role"). The gateway allows Internal User, Internal Viewer and Admin Viewer as base roles. Each option shows its label and raw value. Defaults to the first one the gateway lists. |
| Grant everything (*) | Switch | Grants every permission in the catalogue. Denied permissions below still win. |
| Permission groups | Collapsible sections | One section per permission area, taken from the part of each permission name before the first dot. Each shows "N of M configured". All open by default. |
Inside each group, every permission shows its name, a badge with how many routes it covers (hover the badge for the route list), a description, and three choices.
| Choice | Effect |
|---|---|
| Inherit | The base role decides. Disabled while Grant everything is on. |
| Grant | The role may call the permission's routes even if the base role cannot. |
| Deny | The role may not call the permission's routes even if the base role can. |
Create Role or Save Role saves the role and reads "Creating..." or "Saving..." while it runs. On success "Role created successfully" or "Role updated successfully" shows and the dialog closes. Users who already hold an edited role pick up the change on their next request. Cancel closes without saving. The dialog cannot be closed while a save runs.
Empty, error and disabled states
| Situation | What you see | What to do |
|---|---|---|
| No custom roles | "No custom roles yet" and "Create a role to grant or deny permissions on top of a built-in base role." | Create a role. |
| Role list fails to load | "Couldn't load custom roles" followed by the reason and "This is not an empty list. Check your connection and permissions, then retry." Retry loads the list again. | Press Retry. |
| Table loading | "Loading roles…" | Wait for the list. |
| Permission catalogue fails | "Could not load the permission catalogue." in the dialog | Reload the page and check the license. |
| Save or delete fails | The gateway's error in a toast, such as a name that already exists | Pick another name or check your role. |
| No license feature | "Custom roles needs a Spanway Enterprise license" | Add the custom_roles feature to the license. |
Differences by role and license
| Role or setting | Effect on this page |
|---|---|
| Proxy admin (session role Admin) | Sees the page, + Create Role and the row menu. |
View-only admin (proxy_admin_viewer) | Gets session role Admin Viewer and sees the roles under the view-only banner, without + Create Role or the row menu. The gateway lets this role read roles and refuses changes. |
| Organization admin, Internal User and Internal Viewer | Do not see the page in the nav. The gateway refuses their calls to read or change roles. |
| License | The custom_roles feature is required for the page and for every role route. If the license information cannot be read, the UI hides the page and shows "Custom roles is hidden until the license can be checked". |
Errors
| What you see | What it means | Fix |
|---|---|---|
| A card that says Roles needs a Spanway Enterprise license | The license lacks custom_roles. | Add the feature. |
| No + Create Role button | Only proxy admins manage roles. | Sign in as a proxy admin. |
| A user with the role still cannot open a page | The left nav follows the user's Global Proxy Role, not the custom role. | Open the page by its address, the granted routes still work. |
A user sees a page or button, but saving gives 403 | The left nav and buttons still follow the user's Global Proxy Role, while the gateway checks the custom role's base role for anything the role does not grant. A role based on a viewer role refuses writes even when the user's own role could make them. | Grant the write permission in the role, or pick a base role that allows the change. |
| A route still refuses the user | A denial wins over a grant, or the route is outside the permission catalogue. | Check the role's denied permissions. |