Admin: create user accounts directly #331

Closed
opened 2026-08-05 12:09:25 +02:00 by fable-5 · 0 comments
Collaborator

Problem

A site admin currently has no way to create user accounts. Accounts only come into existence via:

  1. self-registration (auth.registrationMode = open),
  2. OIDC first-login provisioning,
  3. the first-run setup / SETUP_ADMIN_* seeding (initial admin only).

On a closed instance (registration closed, no external IdP) the only workaround is to temporarily open registration, which is awkward and briefly exposes the instance to unwanted signups.

Proposal

Add a Create user capability to the site-admin user management:

  • POST /api/v1/admin/users (site-admin guard) with username, email, display name, locale and an initial password.
  • The account is created with the email marked as verified (the admin vouches for the address) and the personal pond is provisioned exactly like the verify-email path does (markEmailVerified alone does NOT create the personal pond).
  • The user manager UI gets a create-user form/dialog (i18n de+en, accessible, covered by the a11y pack if it becomes a new screen).
  • New audit action (e.g. user.created_by_admin) -> audit-actions.ts + docs/architecture/audit-events.md + catalogue minor bump.
  • Validation mirrors registration rules (username/email uniqueness, password policy).

Acceptance criteria

  • Site admin can create a user via the UI; the user can log in with the initial password right away.
  • Personal pond exists for the created user.
  • Non-admins get 404/403 per the access policy; route has an explicit rule for the route-permissions fence.
  • Audit event is recorded and catalogued.
  • API e2e-db tests + a web e2e test that creates a user through the UI.
## Problem A site admin currently has no way to create user accounts. Accounts only come into existence via: 1. self-registration (`auth.registrationMode = open`), 2. OIDC first-login provisioning, 3. the first-run setup / `SETUP_ADMIN_*` seeding (initial admin only). On a closed instance (registration `closed`, no external IdP) the only workaround is to temporarily open registration, which is awkward and briefly exposes the instance to unwanted signups. ## Proposal Add a **Create user** capability to the site-admin user management: - `POST /api/v1/admin/users` (site-admin guard) with username, email, display name, locale and an initial password. - The account is created with the email marked as verified (the admin vouches for the address) and the personal pond is provisioned exactly like the verify-email path does (`markEmailVerified` alone does NOT create the personal pond). - The user manager UI gets a create-user form/dialog (i18n de+en, accessible, covered by the a11y pack if it becomes a new screen). - New audit action (e.g. `user.created_by_admin`) -> `audit-actions.ts` + `docs/architecture/audit-events.md` + catalogue minor bump. - Validation mirrors registration rules (username/email uniqueness, password policy). ## Acceptance criteria - [ ] Site admin can create a user via the UI; the user can log in with the initial password right away. - [ ] Personal pond exists for the created user. - [ ] Non-admins get 404/403 per the access policy; route has an explicit rule for the route-permissions fence. - [ ] Audit event is recorded and catalogued. - [ ] API e2e-db tests + a web e2e test that creates a user through the UI.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: stwaidele/dorfteich#331
No description provided.