Class InvitationPolicy
When an invitation expires. The single copy of that rule.
public static class InvitationPolicy
- Inheritance
-
InvitationPolicy
- Inherited Members
Remarks
Two places need the answer and they must not disagree: TeamServiceBase.SetInvitationResponseAsync
refuses an expired invitation, and ITeamInvitationService.GetInvitationAsync reports one as expired
so the screen can say so rather than showing a join button that throws.
Kept as one static because this codebase has already paid twice for the same rule living in two places — most recently Tharga/Team#248, where a read gate recomputed what the claims builder had already decided and the two drifted apart. A rule with two copies is a rule with a future defect.
Methods
ExpiresAt(Invitation, TimeSpan?)
When invitation stops being acceptable, or null if it never does.
public static DateTime? ExpiresAt(Invitation invitation, TimeSpan? lifetime)
Parameters
invitationInvitationlifetimeTimeSpan?
Returns
Remarks
The invitation's own ExpiresAt wins when set — that is what an extension
moves, and why extending does not have to reissue the code. Otherwise the configured
lifetime is measured from InviteTime. No lifetime and no
stored expiry means the invitation does not expire, which is the behaviour before any of this existed.
HasExpired(Invitation, TimeSpan?, DateTime)
Whether invitation has expired as at asAt.
public static bool HasExpired(Invitation invitation, TimeSpan? lifetime, DateTime asAt)
Parameters
invitationInvitationlifetimeTimeSpan?asAtDateTime
Returns
Remarks
A null invitation is not expired. It means "nothing found", and the caller that looked it up answers that separately — reporting a missing invitation as an expired one would tell an unauthenticated visitor that a code they invented once existed.