Users and their roles can only be managed with CLI commands (#15, #17). Add a REST API and a UI page for managing users: list, create, edit, delete, reset passwords and set roles.
Managing roles themselves (creating, updating or deleting roles and their operations) is out of scope and stays CLI-only. The API only exposes a read-only list of roles, so the UI can offer them when assigning roles to a user.
User management is intentionally not exposed as MCP tools.
update covers editing user details (login) and resetting another user's password; grant_role covers setting a user's roles; grant_admin is additionally required to give the admin role
role
read
listing roles and their operations
user:update does not allow changing roles.
user:grant_role does not imply user:grant_admin, and user:grant_admin does not imply user:grant_role. Giving a user admin requires both.
admin (*:*) gets these automatically; nobody doesn't.
API
Available only when auth is enabled; with auth disabled these endpoints return 404. Responses never include password hashes.
GET /api/v1/users (user:read) - lists users: id, login, roles, timestamps.
GET /api/v1/users/:id (user:read) - one user.
POST /api/v1/users (user:create) - body { login, password, roles? }.
Same rules as user:create in the CLI: password hashed with scrypt; nobody if roles is omitted or empty.
Passing a non-empty roles also requires user:grant_role, and user:grant_admin if it includes admin.
409 if the login exists, 400 for an unknown role.
PATCH /api/v1/users/:id (user:update) - body { login }, edits user details. Roles and password can't be changed here.
Renaming is safe because tokens identify users by id (#15).
409 if the new login is taken.
PUT /api/v1/users/:id/password (user:update) - body { password }, sets another user's password without the old one.
400 for your own account: changing your own password goes through #16, which requires the old password.
PUT /api/v1/users/:id/roles (user:grant_role, plus user:grant_admin if the user doesn't have admin yet and the new list adds it) - body { roles: [name, ...] }.
Replaces the user's roles, with the same semantics as user:set_roles in #17, including for an empty list.
400 for an unknown role, 409 if the change would leave no admin.
DELETE /api/v1/users/:id (user:delete) - deletes the user and their role assignments.
Tokens of a deleted user stop working on their next request (401), because the user id in the token no longer resolves.
All endpoints are documented in Swagger.
Client
A new "Users" page, shown in the navigation only when auth is enabled and the user has user:read.
Table: login, roles, created date.
"Create user" form: login, password, repeat password, and roles (multi-select from GET /roles, defaulting to nobody).
Edit user: login.
Edit roles: a multi-select of all roles; built-in roles are marked.
Reset password: a form with new password and repeat new password fields.
Delete user, with a confirmation dialog.
Password fields have visibility toggle buttons, like on the change password page (#16).
Each action is shown only if the user has the matching operation:
Edit user and reset password need user:update; edit roles needs user:grant_role and role:read.
Roles are shown read-only otherwise.
The roles field in the create form appears only with user:grant_role and role:read. Without them, new users get nobody.
admin isn't selectable without user:grant_admin.
Reset password and delete aren't offered for your own account.
API errors (409 last admin, 409 login exists, 400 unknown role, 400 own account, 403 missing operation) are shown as readable messages.
New strings in en.json; Storybook stories for any new client/src/ui/ components.
Docs
docs/architecture.md: the user management API and the new operations, including how user:update, user:grant_role and user:grant_admin relate.
Acceptance criteria
An admin can list, create, edit and delete users, reset their passwords and set their roles from the UI.
A user with user:update but without user:grant_role:
can rename users and reset their passwords
gets 403 when setting roles or creating a user with roles
A user with user:grant_role but without user:grant_admin:
can set non-admin roles
gets 403 when adding admin to a user or creating a user with admin
A user with user:grant_admin but without user:grant_role can't set any roles.
A user with only user:read (and role:read) sees the Users page read-only; write endpoints return 403.
A user without user:read doesn't see the page, and GET /users returns 403.
Creating a user without roles gives them nobody. Duplicate logins and unknown roles are rejected.
After a rename, the user logs in with the new login and their existing tokens keep working.
Removing admin from, or deleting, the last admin is rejected with 409.
Deleting your own account, or resetting your own password through this endpoint, is rejected with 400.
After a password reset, the user can log in only with the new password.
After deletion, the user's existing tokens return 401.
With auth disabled, the endpoints return 404 and the page is hidden.
Server tests cover each endpoint's success, permission (403) and validation cases.
## Summary
Users and their roles can only be managed with CLI commands (#15, #17). Add a REST API and a UI page for managing users: list, create, edit, delete, reset passwords and set roles.
Managing roles themselves (creating, updating or deleting roles and their operations) is out of scope and stays CLI-only. The API only exposes a read-only list of roles, so the UI can offer them when assigning roles to a user.
User management is intentionally **not** exposed as MCP tools.
## Requirements
### Operations
Add to the operations list from #17:
| Entity | Modes | Covers |
|---|---|---|
| `user` | `read`, `create`, `update`, `delete`, `grant_role`, `grant_admin` | `update` covers editing user details (login) and resetting another user's password; `grant_role` covers setting a user's roles; `grant_admin` is additionally required to give the `admin` role |
| `role` | `read` | listing roles and their operations |
- `user:update` does **not** allow changing roles.
- `user:grant_role` does **not** imply `user:grant_admin`, and `user:grant_admin` does not imply `user:grant_role`. Giving a user `admin` requires both.
- `admin` (`*:*`) gets these automatically; `nobody` doesn't.
### API
Available only when auth is enabled; with auth disabled these endpoints return `404`. Responses never include password hashes.
- `GET /api/v1/users` (`user:read`) - lists users: `id`, `login`, roles, timestamps.
- `GET /api/v1/users/:id` (`user:read`) - one user.
- `POST /api/v1/users` (`user:create`) - body `{ login, password, roles? }`.
- Same rules as `user:create` in the CLI: password hashed with scrypt; `nobody` if `roles` is omitted or empty.
- Passing a non-empty `roles` also requires `user:grant_role`, and `user:grant_admin` if it includes `admin`.
- `409` if the login exists, `400` for an unknown role.
- `PATCH /api/v1/users/:id` (`user:update`) - body `{ login }`, edits user details. Roles and password can't be changed here.
- Renaming is safe because tokens identify users by `id` (#15).
- `409` if the new login is taken.
- `PUT /api/v1/users/:id/password` (`user:update`) - body `{ password }`, sets another user's password without the old one.
- `400` for your own account: changing your own password goes through #16, which requires the old password.
- `PUT /api/v1/users/:id/roles` (`user:grant_role`, plus `user:grant_admin` if the user doesn't have `admin` yet and the new list adds it) - body `{ roles: [name, ...] }`.
- Replaces the user's roles, with the same semantics as `user:set_roles` in #17, including for an empty list.
- `400` for an unknown role, `409` if the change would leave no admin.
- `DELETE /api/v1/users/:id` (`user:delete`) - deletes the user and their role assignments.
- `400` when deleting your own account.
- `409` if it would leave no admin.
- `GET /api/v1/roles` (`role:read`) - lists roles: `id`, `name`, `builtIn`, operation patterns. Read-only.
- `404` for an unknown user id.
- Tokens of a deleted user stop working on their next request (`401`), because the user id in the token no longer resolves.
- All endpoints are documented in Swagger.
### Client
- A new "Users" page, shown in the navigation only when auth is enabled and the user has `user:read`.
- Table: login, roles, created date.
- "Create user" form: login, password, repeat password, and roles (multi-select from `GET /roles`, defaulting to `nobody`).
- Edit user: login.
- Edit roles: a multi-select of all roles; built-in roles are marked.
- Reset password: a form with new password and repeat new password fields.
- Delete user, with a confirmation dialog.
- Password fields have visibility toggle buttons, like on the change password page (#16).
- Each action is shown only if the user has the matching operation:
- Edit user and reset password need `user:update`; edit roles needs `user:grant_role` and `role:read`.
- Roles are shown read-only otherwise.
- The roles field in the create form appears only with `user:grant_role` and `role:read`. Without them, new users get `nobody`.
- `admin` isn't selectable without `user:grant_admin`.
- Reset password and delete aren't offered for your own account.
- API errors (`409` last admin, `409` login exists, `400` unknown role, `400` own account, `403` missing operation) are shown as readable messages.
- New strings in `en.json`; Storybook stories for any new `client/src/ui/` components.
### Docs
- `docs/architecture.md`: the user management API and the new operations, including how `user:update`, `user:grant_role` and `user:grant_admin` relate.
## Acceptance criteria
- An `admin` can list, create, edit and delete users, reset their passwords and set their roles from the UI.
- A user with `user:update` but without `user:grant_role`:
- can rename users and reset their passwords
- gets `403` when setting roles or creating a user with roles
- A user with `user:grant_role` but without `user:grant_admin`:
- can set non-admin roles
- gets `403` when adding `admin` to a user or creating a user with `admin`
- A user with `user:grant_admin` but without `user:grant_role` can't set any roles.
- A user with only `user:read` (and `role:read`) sees the Users page read-only; write endpoints return `403`.
- A user without `user:read` doesn't see the page, and `GET /users` returns `403`.
- Creating a user without roles gives them `nobody`. Duplicate logins and unknown roles are rejected.
- After a rename, the user logs in with the new login and their existing tokens keep working.
- Removing `admin` from, or deleting, the last admin is rejected with `409`.
- Deleting your own account, or resetting your own password through this endpoint, is rejected with `400`.
- After a password reset, the user can log in only with the new password.
- After deletion, the user's existing tokens return `401`.
- With auth disabled, the endpoints return `404` and the page is hidden.
- Server tests cover each endpoint's success, permission (`403`) and validation cases.
ars9
added this to the User management milestone 2026-10-07 21:20:40 +03:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Users and their roles can only be managed with CLI commands (#15, #17). Add a REST API and a UI page for managing users: list, create, edit, delete, reset passwords and set roles.
Managing roles themselves (creating, updating or deleting roles and their operations) is out of scope and stays CLI-only. The API only exposes a read-only list of roles, so the UI can offer them when assigning roles to a user.
User management is intentionally not exposed as MCP tools.
Requirements
Operations
Add to the operations list from #17:
userread,create,update,delete,grant_role,grant_adminupdatecovers editing user details (login) and resetting another user's password;grant_rolecovers setting a user's roles;grant_adminis additionally required to give theadminrolerolereaduser:updatedoes not allow changing roles.user:grant_roledoes not implyuser:grant_admin, anduser:grant_admindoes not implyuser:grant_role. Giving a useradminrequires both.admin(*:*) gets these automatically;nobodydoesn't.API
Available only when auth is enabled; with auth disabled these endpoints return
404. Responses never include password hashes.GET /api/v1/users(user:read) - lists users:id,login, roles, timestamps.GET /api/v1/users/:id(user:read) - one user.POST /api/v1/users(user:create) - body{ login, password, roles? }.user:createin the CLI: password hashed with scrypt;nobodyifrolesis omitted or empty.rolesalso requiresuser:grant_role, anduser:grant_adminif it includesadmin.409if the login exists,400for an unknown role.PATCH /api/v1/users/:id(user:update) - body{ login }, edits user details. Roles and password can't be changed here.id(#15).409if the new login is taken.PUT /api/v1/users/:id/password(user:update) - body{ password }, sets another user's password without the old one.400for your own account: changing your own password goes through #16, which requires the old password.PUT /api/v1/users/:id/roles(user:grant_role, plususer:grant_adminif the user doesn't haveadminyet and the new list adds it) - body{ roles: [name, ...] }.user:set_rolesin #17, including for an empty list.400for an unknown role,409if the change would leave no admin.DELETE /api/v1/users/:id(user:delete) - deletes the user and their role assignments.400when deleting your own account.409if it would leave no admin.GET /api/v1/roles(role:read) - lists roles:id,name,builtIn, operation patterns. Read-only.404for an unknown user id.401), because the user id in the token no longer resolves.Client
user:read.GET /roles, defaulting tonobody).user:update; edit roles needsuser:grant_roleandrole:read.user:grant_roleandrole:read. Without them, new users getnobody.adminisn't selectable withoutuser:grant_admin.409last admin,409login exists,400unknown role,400own account,403missing operation) are shown as readable messages.en.json; Storybook stories for any newclient/src/ui/components.Docs
docs/architecture.md: the user management API and the new operations, including howuser:update,user:grant_roleanduser:grant_adminrelate.Acceptance criteria
admincan list, create, edit and delete users, reset their passwords and set their roles from the UI.user:updatebut withoutuser:grant_role:403when setting roles or creating a user with rolesuser:grant_rolebut withoutuser:grant_admin:403when addingadminto a user or creating a user withadminuser:grant_adminbut withoutuser:grant_rolecan't set any roles.user:read(androle:read) sees the Users page read-only; write endpoints return403.user:readdoesn't see the page, andGET /usersreturns403.nobody. Duplicate logins and unknown roles are rejected.adminfrom, or deleting, the last admin is rejected with409.400.401.404and the page is hidden.403) and validation cases.