Operator guide to user, group, and role management in Styrmin. Covers roles, the bootstrap admin, the driver actions user, the admin UI, lockout recovery, the SDK equivalent, and the "hide-not-disable" UI principle.
Styrmin has three flat roles:
| Role (label / enum) | Permitted operations |
|---|---|
Read-only (READ_ONLY) |
Read every non-admin resource (deployments, environments, drivers, clusters, services, status). |
Read/write (READ_WRITE) |
Everything Read-only can do, plus create / edit / delete deployments, environments, env vars, backups, schedules. |
Admin (ADMIN) |
Everything Read/write can do, plus manage users, groups, the bootstrap admin, and every admin-only field on the User type. |
The UI displays the human labels ("Admin", "Read/write", "Read-only"); the GraphQL API and SDK use the raw enum values shown in parentheses.
Every user has a direct role (user.role, set on the row). Membership
in a group also confers a role — when a user is a member of one or more
groups, the effective role is the maximum of the direct role and the
roles of every group the user belongs to. The GraphQL User type
exposes both as role and effectiveRole; the frontend authorization
predicate (<IfRole minimum=...>) and the backend _requires(Role.X)
extension both read effectiveRole, never role.
This is what lets an admin grant elevated access by adding a user to a
group (e.g., platform-admins with role=ADMIN) without changing the
user's direct role.
The backend bootstrap step (backend/styrmin_backend/services/auth/bootstrap.py)
ensures at least one active admin exists at startup.
| Env var | Effect |
|---|---|
STYRMIN_ADMIN_USERNAME |
Username of the bootstrap admin. Defaults to admin. |
STYRMIN_ADMIN_PASSWORD |
Password for the bootstrap admin. If unset, a strong random password is generated and logged once. |
When STYRMIN_ADMIN_PASSWORD is unset, the server logs a single line on
startup:
Bootstrapped admin user 'admin' with a generated password <password>
Copy that password from the log — it is not persisted anywhere else and will not be re-emitted on subsequent restarts (the bootstrap is idempotent and only sets a password the first time the row is created). If you lose it, see Lockout recovery.
Driver actions call the Styrmin API to stop components, start components and
change the deployment version. Styrmin's flows and actions also record the
steps of tasks, backups and restores through the recordStep mutation. They
call the API as the built-in user styrmin-actions. Styrmin creates this user
the first time it needs a token for it (ensure_actions_service_account in
backend/styrmin_backend/services/auth/bootstrap.py). See
ADR-059 and
ADR-060.
-
Its role is
READ_WRITE, whichstopComponents,startComponents,updateDeploymentVersionandrecordSteprequire. -
recordStepaccepts only this user. Every other user, admins included, getsFORBIDDEN, so no person can change the recorded steps. -
It has no password, and no one can log in as it, so only Styrmin's own flows and actions can create sessions for it:
loginrejects every password for it withINVALID_CREDENTIALS;resetUserPasswordandchangePasswordrefuse it withFORBIDDEN;createUserrefuses the usernamestyrmin-actionswithFORBIDDEN.
-
Styrmin creates a session for it that expires after 24 hours, passes the token in
STYRMIN_TOKENto the flow that does the work, which the agent runs as a process in the agent pod, and deletes the session when the work ends. This happens once for each:- reconcile (
apply_state), whose actions also receive the token; run_jobtask;- backup;
- restore.
So several sessions of this user can exist at the same time while reconciles, jobs, backups or restores run.
- reconcile (
The user appears in the Users list. Changes to it have these effects:
- Deactivating it makes every API call made with its token fail with
Authentication is required:- the driver action primitives
stop_components,start_componentsandupgrade_deployment_versionraise an error, so the hooks that call them fail; recordStepcalls fail, so steps are no longer recorded. These failures alone do not stop the work, because a failed step write never fails it.
- the driver action primitives
- Setting its role to
READ_ONLYmakes those calls fail withInsufficient permissions, with the same effects. - Adding it to a group with a higher role gives actions that higher role, because actions use the user's effective role.
- Resetting its password is refused with
FORBIDDEN. - Deleting it also deletes the sessions of reconciles, jobs, backups and restores that are running, so their actions fail and their steps stop being recorded. The next of these operations creates the user again.
The admin UI is reached via Settings → Access, which exposes the
Users and Groups tabs. The Access section of Settings only
renders for users whose effective role is Admin. The direct URLs
/users and /groups continue to work as deep links, but non-admins
who navigate there directly land on an in-app access-denied page rather
than being silently redirected.
- Open Settings → Access → Users (deep link:
/users). The table lists every user with their direct role, active flag, and group memberships. - Click Create user to open the create dialog. Required: username, display name, password (≥ 8 chars; inline guidance below the field describes the policy), role. Optional: group memberships.
- Click any row to open
/users/$id(the detail page). Inline-edit display name, role, active flag, and group memberships from there. Username is not editable — see below. - Reset password opens a confirmation dialog and then issues a new password. Every existing session for that user is invalidated — they will be logged out everywhere.
- Delete user hard-deletes the user row after an in-app
confirmation dialog. Two guards apply:
USER_HAS_REFERENCES— the user owns deployments (or any FK reference). Reassign or remove those references first.LAST_ADMIN— deleting (or deactivating, or demoting) this user would leave zero active admins. Promote another user first.
- Open Settings → Access → Groups (deep link:
/groups). The table lists every group with its role and member count. - Create a group with Create group: name, role, optional initial member set.
- Click any row to open
/groups/$id. The member multi-select uses replace semantics — submitting overwrites the full member set. - The
LAST_ADMINguard applies to group changes too: removing the only admin-conferring membership of the last active admin is rejected withLAST_ADMIN.
Every authenticated user (regardless of role) has a /profile page,
reachable from the header avatar menu. Users can edit their own display
name and change their own password from there. Username is read-only:
it is immutable for everyone, including admins (see Usernames are
immutable).
Changing your own password from /profile invalidates every other
session you have. Your current session is preserved.
Usernames cannot be changed after creation — there is no
updateUser.username field on the GraphQL API and no UI affordance for
it. To change a user's login identity, deactivate the existing user and
create a new one with the desired username. Display name remains
editable and is what surfaces in most UI surfaces.
When an unauthenticated user opens a deep link (for example,
/deployments/some-id), the router sends them to /login?next=<path>.
After a successful login they are redirected back to the original
target rather than dropped on the dashboard.
There is no recovery flow in v1. If every admin loses access:
- Stop the backend.
- Set
STYRMIN_ADMIN_USERNAMEandSTYRMIN_ADMIN_PASSWORDin the backend environment to credentials you control. - Manually mark the bootstrap admin row as needing re-creation by
deleting it from the database (or directly setting its
password_hashto a new argon2id hash andactive=true). - Restart the backend. The bootstrap will create (or repair) the admin row using the env vars.
This is intentionally crude — a self-service "forgot password" flow is a future feature, not an v1 requirement.
Every operation in the admin UI is also exposed on StyrminClient.users
and StyrminClient.groups. Both namespaces require an authenticated
admin session.
import asyncio
import os
from styrmin_sdk import StyrminClient
from styrmin_sdk.graphql._generated.enums import Role
async def main() -> None:
async with StyrminClient(server_address="http://localhost:8000") as client:
await client.auth.login("admin", os.environ["STYRMIN_ADMIN_PASSWORD"])
alice = await client.users.create(
username="alice",
password="hunter22!",
display_name="Alice",
role=Role.READ_WRITE,
)
await client.users.update(alice.id, role=Role.READ_ONLY)
await client.users.reset_password(alice.id, "new-pass-123")
await client.users.update(alice.id, active=False)
await client.users.delete(alice.id)
asyncio.run(main())See python_sdk/examples/users_groups.py for a ready-to-run version.
The frontend hides write controls from users who do not have permission to use them; it does not show greyed-out buttons. This is deliberate:
- A grey "Create deployment" button that does nothing on click is noisier than the absence of a button. The UI should reflect the effective capability set of the current session.
- The authorisation gate is enforced on the server (the
_requires(Role.X)extension on every mutation); the frontend hide is a UX optimisation, not a security boundary. - The role gating uses
effectiveRole, so a user with direct roleREAD_ONLYbut membership in anADMINgroup sees the admin UI.
To inspect what a user can see, fetch currentUser.effectiveRole:
query { currentUser { id username role effectiveRole } }If effectiveRole is not what you expect, check the user's group
memberships at /users/$id (admin view) — effectiveRole is the max
of role and the role of every group the user belongs to.
The following are deliberately out of scope for the v1 user/group/auth surface. They are not bugs — track them as follow-up features.
- MFA / 2FA — there is no second factor. Username + password is the only credential.
- Brute-force lockout —
/logindoes not rate-limit failed attempts. Run behind an upstream that enforces rate limiting if you need it. - SSO / OIDC / SAML — no external identity provider integration. All users are local rows in the Styrmin database.
- Agent credentials — driver actions call the API as
styrmin-actions. The agent status reporter, the flow-run state callback and theGET /deployments/{id}/contextroute still accept calls without credentials (#396, and theTODO(#396)notes inbackend/styrmin_backend/api/auth/allowlist.py). - Audit-log tables — admin mutations are emitted to stdout via the structured audit log line. There is no queryable history table; if you need durable audit history, ship the stdout stream to your log aggregator.