3.9 KiB
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:
GetAllPendingInvitationsAsynclisted only unexpired invitations. An invitation that was not activated in time disappeared from the list: invisible, so impossible to remove.- 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);InvitationServiceuses it.GetAllPendingInvitationsAsyncincludes 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 ->
ValidateInvitationAsyncfalse andCompleteInvitationAsyncthrows Unauthorized, no user created. - Expired invitation is listed with
IsExpiredand can be deleted; controller returnsInvitationExpiredand 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