Expire invitations when archiving user
Ensure ArchiveUser deactivates pending invitations for the archived\nprofile so invited accounts cannot still activate after archive. Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Bryan FRIMIN <bryan@frimin.fr>
This commit is contained in:
committed by
Bryan Frimin
parent
0f8c9e1217
commit
41991f3879
@@ -407,6 +407,18 @@ func (s *OrganizationService) ArchiveUser(
|
||||
}
|
||||
}
|
||||
|
||||
invitations := &coredata.Invitations{}
|
||||
onlyPending := coredata.NewInvitationFilter([]coredata.InvitationStatus{coredata.InvitationStatusPending})
|
||||
if err := invitations.ExpireByUserID(
|
||||
ctx,
|
||||
tx,
|
||||
scope,
|
||||
profile.ID,
|
||||
onlyPending,
|
||||
); err != nil {
|
||||
return fmt.Errorf("cannot expire pending invitations: %w", err)
|
||||
}
|
||||
|
||||
now := time.Now()
|
||||
|
||||
if profile.State != coredata.ProfileStateInactive {
|
||||
|
||||
Reference in New Issue
Block a user