Gebruikerslijst: verlopen uitnodiging tonen, Beheerder mag uitnodiging intrekken, neutrale tekst bij ongeldige link

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-08 15:49:33 +01:00
co-authored by Claude Sonnet 5.5
parent ed7a172f44
commit 0932ee36b3
9 changed files with 136 additions and 8 deletions
+1
View File
@@ -11,3 +11,4 @@
| Feature | SlpSoftware Production API (slpsoftware-api) | ✅ Complete | feature/slpsoftware-api | Clients (new Api.SlpSoftware), Modules (new Offerings module + Tests), Core (CmsHost), CI/CD (retargeted to Api.SlpSoftware) | 2026-08-02 |
| Feature | Andrea's site hosting (andreaslop-site-hosting) | 🟡 Operations (wacht op CI-proef en eerste test-deploy) | feature/andreaslop-site-hosting | Core (CmsHost, CSP, static content), Clients (new Api.AndreaSlopFotografie), Frontend (theme), CI/CD | 2026-11-06 |
| Bug | [cms-admin-nine-points](bugs/cms-admin-nine-points/bug-fix.md) | ✅ Complete (wacht op goedkeuring ASF test) | feature/andreaslop-site-hosting | Core (auth, invitations), Identity, Availability, Frontend | 2026-11-08 |
| Bug | [invitation-delete-and-lifetime](bugs/invitation-delete-and-lifetime/bug-fix.md) | ✅ Complete (wacht op goedkeuring ASF test) | feature/andreaslop-site-hosting | Core (invitations), Identity, Frontend | 2026-11-08 |
@@ -0,0 +1,55 @@
# Bug Fix: pending invitations cannot be removed; invitation lifetime not configurable
- **Slug**: invitation-delete-and-lifetime
- **Status**: Complete (pending ASF test approval by Bryan)
- **Issue**: None (relayed by session "CMS & API" from Bryan, 2026-11-08)
- **Branch**: feature/andreaslop-site-hosting
- **Started**: 2026-11-08
- **Documentation Language**: English
- **Conversation Language**: Dutch (user language)
## Report
A. An invited but not yet activated user cannot be deleted.
B. The activation lifetime is too short; wanted: 24 hours, configurable (Identity option), no second place with another duration.
C. "Nieuwe activatiecode aanvragen" does nothing, no mails are sent (analysis only, nothing built without Bryan's go).
## Root Cause
**A.** The delete path itself works (`DELETE Users/{id}` falls back to `DeleteInvitationByIdAsync`, the row is removed and the token stops working). Two causes made it unreachable:
1. `GetAllPendingInvitationsAsync` listed only unexpired invitations. An invitation that was not activated in time disappeared from the list: invisible, so impossible to remove.
2. The Delete action was Owner-only in the UI. An Administrator (who can invite) saw no Delete action on a pending invitation.
The cause could not be confirmed against Bryan's actual session; both are real and fixed.
**B.** One place, hardcoded: `InvitationService.CreateInvitationAsync` used `AddDays(1)` (already 24 hours). No other duration exists in backend or frontend texts (no text names the duration). If Bryan saw a shorter effective time, the likely suspects are the unconfigurable value and the "expired" screen being shown for withdrawn links too; a database time-zone effect on the `datetime` column (DateTimeOffset stored without offset) cannot be excluded from here and needs a look at a real row on the test host.
**C.** See the analysis sent to the peer: there is no mail system anywhere (no SMTP/provider/sender code or config); the button on the invite-error page only navigates to `/`.
## The Fix
- `InvitationSettings` (`Identity:Invitation:ExpiryHours`, default 24, validated 1..720, `ValidateOnStart`); `InvitationService` uses it.
- `GetAllPendingInvitationsAsync` includes expired invitations (`PendingInvitationInfo.IsExpired`); `UserDto.InvitationExpired`; expired rows have no invite link. UI: status "Uitnodiging verlopen", no copy-link action, still removable.
- UI: an Administrator may withdraw a pending invitation for a plain User (same reach as assigning that role); account deletion stays Owner-only.
- Invite-error page: neutral title "Link ongeldig of verlopen" (it used the "system setup required" text) and text that covers expired, withdrawn and unknown links.
**Left unchanged, reported**: `DELETE Users/{id}` has no role hierarchy: an Administrator calling the API directly can delete an Owner or another Administrator (only the last-Owner rule protects). Pre-existing; needs a decision before changing.
## Verification
**Path used**: Automated test framework
- Revocation really invalidates: delete -> `ValidateInvitationAsync` false and `CompleteInvitationAsync` throws Unauthorized, no user created.
- Expired invitation is listed with `IsExpired` and can be deleted; controller returns `InvitationExpired` and no link for it.
- Lifetime: default 24 h, configured 72 h, config binding default/48, out-of-range values (0, -5, 721) rejected.
- Frontend: Owner and Administrator delete rules, expired row (label, no copy link, deletable), neutral invalid-link text.
- Core.Tests 379, Identity 58, Availability 82, Master 57, Offerings 57; frontend 322; tsc and eslint clean.
## Impact on SlpSoftware
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.
## Result
- **PR(s)**: None
- **Commit(s)**: see branch history
- **Completed**: 2026-11-08