Gebruikerslijst volgt de rolhierarchie, nieuwe uitnodigingslink maken, foutkaart zonder nep-aanvraagknop

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-08 15:59:10 +01:00
co-authored by Claude Sonnet 5.5
parent 026a12a3f1
commit e9feb37961
9 changed files with 118 additions and 17 deletions
@@ -48,6 +48,13 @@ The cause could not be confirmed against Bryan's actual session; both are real a
No migration. Behaviour: expired invitations now appear in the users list (removable), lifetime configurable (default unchanged at 24 h; an invalid value fails startup), Administrator can withdraw User invitations, invite-error text changed.
## Follow-up decisions (Bryan, relayed 2026-11-08)
1. **Role hierarchy closed in the API** (the gap reported above). `UserManagementRules` (Core): an Owner manages everyone; an Administrator only plain Users (delete, deactivate, change role, withdraw/regenerate an invitation) and may never hand out the Owner role (also not by invitation); an Administrator may still step down to User themselves; the last-Owner rule is unchanged. The requester's role is read from the database (not the possibly stale token); an unresolvable caller is treated as Administrator. Enforced in `UsersController` (Invite, ChangeRole, SetUserActive, DeleteUser, RegenerateInvite); the UI mirrors it (Administrators see delete/deactivate/regenerate for Users only, nothing for Administrators and Owners). Tests: `UsersControllerRoleHierarchyTests` (hierarchy rules, each action, invitations, last Owner).
2. **Invite-error card**: the button that suggested requesting a new link (it only navigated away, there is no mail) is now "Naar inloggen"; the text already says to ask the administrator.
3. **"Nieuwe uitnodigingslink maken"** (small, kept): `POST Users/{id}/regenerate-invite` gives an open or expired invitation a new token and a new lifetime; the old link stops working. The UI action copies the new link. It stays useful as a fallback once e-mail exists. Tests: service (old token invalid, new valid, expired revived, unknown/accepted -> null), controller (hierarchy, 404), UI.
4. **Lifetime shorter than 24 h?** Round trip `DateTimeOffset` -> MariaDB `datetime` -> back was proven against a real MariaDB (server and client in CET, offsets +0/+1/+2/-5 written): the provider stores the UTC clock value and reads it back as UTC, so the remaining lifetime stays 24.00 h. `DateTimeOffsetRoundTripTests` (runs when `ConnectionStrings__DefaultConnection` points at a MariaDB, as in CI; uses its own scratch database; does nothing otherwise). So a time-zone shortening cannot be demonstrated; stored seconds are truncated (sub-second only). To rule out anything on the test host, a read-only look at `AndreaSlopFotografieTest.Invitations` would show `CreatedAt`, `ExpiryDate`, the difference in hours and the server `UTC_TIMESTAMP()`.
## Result
- **PR(s)**: None