Admin-only overview of all cases across owners + an admin delete, gated by a new
`cases:manage` capability (Authz role→cap + CanManageCases + CasesAdmin gate;
FE capability + guard + nav + role.interceptor prefix — the org-template/stamdata
recipe). Backend adds ApplicationStore.ListAll()/DeleteAny() and GET /admin/cases +
DELETE /admin/cases/{id}; admin delete removes ANY case incl. submitted. Page lives
in registratie/ui (owns the Aanvraag aggregate; reuses aanvraag-view + parse),
routed /beheer/zaken; delete guarded by a native confirm, optimistic with rollback.
Typed client regenerated (documents the new endpoints + owner field).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
3.1 KiB
3.1 KiB
WP-36 — Admin cases page + admin delete
Status: done Phase: 7 — refinements
Why
Admins can maintain stamdata and org-templates but have no view of the cases (aanvragen) in the register, and no way to remove an erroneous one. This WP adds an admin-only overview of all cases across owners and an admin delete that can remove any case — the back-office counterpart of the user's own dashboard.
Decisions (made while building — no spec existed; flagged for review)
- Single capability
cases:managecovers both the list and the delete (one back-office concern), following theorgtemplate:edit/stamdata:editprecedent exactly (Authz role→cap + aCanManageCasesgate + aCasesAdmin(ctx,…)helper; FECapabilityunion +me.adapterKNOWN+capabilityGuard+ nav item +role.interceptorprefix). - Page lives in
registratie(notbeheer).registratieowns theAanvraagaggregate, so the admin view reuses itsaanvraag-viewlabels +parseApplicationstrust boundary instead of duplicating them — and it respects the layer boundary (beheermay not importregistratie). This matches the existing pattern (stamdata-admin lives inbeheerbecausebeheerowns stamdata; org-template-admin inbrief). Routed at/beheer/zakenfor a legible admin URL. - Admin delete removes ANY case — any owner, submitted or not — unlike the user-facing
DELETE /applications/{id}(owner-scoped, 409 on a submitted case). That is the admin power. - Native
confirm()guards the delete. No confirm-dialog component exists (the only precedent is a nativeconfirm()in behandel-scherm); the delete is irreversible, so it gets a prompt rather than the dashboard's no-confirm optimistic cancel. - Single owner in practice. Only
DemoOwnerexists, so the list shows that owner's cases with an Owner column; no fake multi-user seed was added (the endpoint is cross-owner-capable —ListAll()— so real multi-owner data would just appear).
Files
- Backend:
ApplicationStore.ListAll()+DeleteAny(id);ApplicationSummaryDto.Owner+ToAdminSummaryDto;Authzcap +CanManageCases;Program.csCasesAdmingate +GET /admin/cases+DELETE /admin/cases/{id};AdminCasesTests(+ update the org-template/mecap-list assertion). SQLite can'tORDER BY DateTimeOffset→ListAllsorts client-side. - FE:
capability.ts+me.adapterKNOWN+role.interceptor(/api/v1/admin/cases);aanvraag.tsowner?;applications.adapterlistAll/deleteAny+ parse owner;registratie/application/admin-cases.store.ts(+spec);registratie/ui/admin-cases.page.ts; route inapp.routes.ts; nav item insite-header; new$localizeids + English targets.
Acceptance criteria
- Admin-only page at
/beheer/zakenlists all cases (owner + type + status), gated bycases:manage(denial alert for non-admins; server re-enforces viaCasesAdmin). - Admin delete removes any case (incl. submitted); confirmed, optimistic with rollback.
npm run cigreen (336 FE tests, backend 129, localized build, drift clean after commit).