Instance settings foundation and registration-mode admin toggle #19

Closed
opened 2026-07-04 14:52:05 +02:00 by fable-5 · 0 comments
Collaborator

Context

Instance-level configuration (registration mode now; quotas, legal pages, upload rules later) needs one typed, cached accessor instead of scattered reads.

Scope

Implement InstanceSettingsService: typed getters/setters over the instance_settings table with Zod-validated values and in-process cache with invalidation; GET/PATCH /admin/settings (Site-Admin-only — introduce the SiteAdminGuard using users.is_site_admin); expose registration_mode and instance default locale. Minimal admin page in the web app (visible only to Site Admins) with the two settings.

Acceptance criteria

  • non-admins get 403 on the admin endpoints and do not see the admin menu
  • changing registration_mode to closed takes effect without restart (cache invalidation test)
  • settings values are validated: an invalid write is rejected with a field error
  • seed script can mark a user as Site Admin for dev/Test

Technical notes

  • ADR 0007, data-model.md (instance_settings), security.md (admin actions audit-logged — write an audit log line).
  • The enum leaves room for approval_required (do not implement it).

Dependencies

Depends on #13, #14, #16.

Size: ~1 day


Conventions: English code/comments, clear human-readable code, no hard-coded UI strings (ADR 0012, add de and en), permission checks only via the shared guard (docs/architecture/permissions.md). Read the referenced ADRs before starting.

## Context Instance-level configuration (registration mode now; quotas, legal pages, upload rules later) needs one typed, cached accessor instead of scattered reads. ## Scope Implement `InstanceSettingsService`: typed getters/setters over the `instance_settings` table with Zod-validated values and in-process cache with invalidation; `GET/PATCH /admin/settings` (Site-Admin-only — introduce the `SiteAdminGuard` using `users.is_site_admin`); expose `registration_mode` and instance default locale. Minimal admin page in the web app (visible only to Site Admins) with the two settings. ## Acceptance criteria - [ ] non-admins get 403 on the admin endpoints and do not see the admin menu - [ ] changing `registration_mode` to `closed` takes effect without restart (cache invalidation test) - [ ] settings values are validated: an invalid write is rejected with a field error - [ ] seed script can mark a user as Site Admin for dev/Test ## Technical notes - ADR 0007, data-model.md (`instance_settings`), security.md (admin actions audit-logged — write an audit log line). - The enum leaves room for `approval_required` (do not implement it). ## Dependencies Depends on #13, #14, #16. **Size**: ~1 day --- *Conventions: English code/comments, clear human-readable code, no hard-coded UI strings (ADR 0012, add `de` **and** `en`), permission checks only via the shared guard (docs/architecture/permissions.md). Read the referenced ADRs before starting.*
fable-5 added this to the M1 — Accounts & authentication milestone 2026-07-04 14:52:05 +02:00
fable-5 added the
backend
auth
labels 2026-07-04 14:52:05 +02:00
Sign in to join this conversation.
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#19
No description provided.