Roles & Permissions (RBAC)¶
Potato supports role-based access control (RBAC): a config-driven mapping of roles to permissions, plus per-user and SSO-based role assignment. This generalizes the older model (a single shared admin API key + an adjudicator allow-list) into a coherent permission system, while remaining fully backward compatible.
What you get¶
- A small, fixed set of permissions.
- Built-in roles (
admin,adjudicator,annotator) plus any custom roles you define. - Role assignment by username, by SSO/OAuth claim (e.g. GitHub org), or
via the existing quota
user_rolesmap. - The shared
admin_api_keyremains a superuser bypass, so existing setups keep working with no changes.
Permissions¶
| Permission | Grants access to |
|---|---|
view_admin_dashboard |
The /admin dashboard and its read APIs |
manage_assignment |
Changing assignment settings (POST /admin/api/config), setting a user's items, and reclaiming items |
manage_users |
Resetting passwords and creating password-reset links |
manage_crowdsourcing |
The crowd-platform panel: publishing studies, approving submissions, paying bonuses |
adjudicate |
The /adjudicate interface and adjudication APIs |
export_data |
Export endpoints |
annotate |
The annotation interface |
view_admin_dashboard is read access. A role that holds only it can open the
dashboard but cannot change settings or accounts, so a "viewer" role cannot
reset someone else's password and sign in as them.
Built-in roles¶
| Role | Permissions |
|---|---|
admin |
all of the above |
adjudicator |
adjudicate, export_data, annotate |
annotator |
annotate |
Configuration¶
All fields are optional. With no rbac block, behavior is identical to
before: only the shared admin key (and the adjudicator_users allow-list)
confers elevated access.
# Shared admin key still works as a superuser bypass (unchanged).
admin_api_key: "your-shared-key"
# Legacy adjudicator allow-list still works (folded into the adjudicator role).
adjudication:
enabled: true
adjudicator_users: ["ed@example.com"]
# Quota labels still drive per_annotator_quota (unchanged). A label only confers
# permissions if it also names a role in rbac.roles below.
user_roles:
alice@example.com: expert
bob@example.com: novice
rbac:
enabled: true
# Define or override roles -> permissions (merged over the built-in defaults).
roles:
lead: [view_admin_dashboard, export_data, annotate]
# Assign roles to specific users (highest precedence).
user_role_assignments:
carol@example.com: admin
dave@example.com: lead
# Map SSO/OAuth claims to roles. Claims currently include "provider:<name>"
# and, for GitHub, "org:<org>".
sso_role_mapping:
"org:my-github-org": adjudicator
Role resolution¶
A user's roles are the union of:
rbac.user_role_assignments[username]- any
rbac.sso_role_mappingentry matching the user's SSO claims - the legacy
adjudicator_userslist →adjudicator user_roles[username]only if that label names a role in the permission map (otherwise it stays a pure quota label, e.g.novice/expert)
A user's permissions are the union of the permissions of all their roles. The
shared admin_api_key bypasses all checks. So does debug: true, but only for
requests from the machine the server runs on: every request when it is bound to
a loopback address (127.0.0.1, localhost), and on 0.0.0.0 a request that
arrives over loopback with no proxy forwarding header. Requests from other
machines, or through a proxy, still need the admin key.
How it's enforced¶
A single helper, RBACManager.check(permission, request, session), backs every
guard, and one decorator, require_permission(...), replaces the previously
duplicated admin_required decorators across the codebase. This means:
- The admin dashboard, adjudication, export, and destructive endpoints all route through the same permission model.
- A logged-in user with an admin-capable role reaches admin endpoints without needing the shared key.
- Requests with a valid shared key always pass, and so do requests to a debug server from the machine it runs on.
Backward compatibility¶
- No
rbacblock → unchanged behavior (shared key +adjudicator_usersonly). user_roleswith non-role labels → still purely workload-quota labels.adjudicator_users→ still authorizes adjudication.
Related¶
- Users & Collaboration
- SSO & OAuth Authentication
- Adjudication
- Per-Cohort Schemas
- Heterogeneous Coverage (per-annotator quotas)