feat(invitations): check contact grants on every read, cap pending invitations, and expire them at the deadline

This commit is contained in:
shira committed 2026-10-09 19:06:50 +03:00
1 parent 676b3c6e24
commit 12a7213d4a
67 files changed
+4255 -149

No files matched your search

@@ -17,15 +17,28 @@ import (
var _ outbound.PrivacyViewRepository = privacyCohortRepository{}
// CurrentFields stays closed until invitation grants have transaction-bound
// persistence. The C4 ledger alone does not identify a live invitation grant.
// CurrentFields stays closed. The card-handle contact read has no contract
// operation; contact values are read only through the invitation grant of
// GetOrganizationInvitationContacts, which locks its own grant and C4 record.
func (privacyCohortRepository) CurrentFields(context.Context, uuid.UUID, uuid.UUID) (domain.ContactFieldSet, error) {
return domain.ContactFieldSet{}, outbound.ErrContactAccessClosed
}
func (privacyCohortRepository) CloseForVisibility(context.Context, uuid.UUID, uuid.UUID, time.Time) error {
// No C4 contact-grant persistence exists in this release. Contact reads are
// closed by default, so there is no persisted grant to reactivate later.
// CloseForVisibility closes the active grants of the candidate, or of one
// organization when organizationID is set, with the reason visibility_closed.
// The publication and the hiding call it in their own transactions.
func (repository privacyCohortRepository) CloseForVisibility(
ctx context.Context,
candidateID, organizationID uuid.UUID,
at time.Time,
) error {
const location = "privacyCohortRepository.CloseForVisibility"
if err := closeActiveContactGrants(ctx, repository.queries, contactGrantClosure{
candidateID: candidateID, organizationID: organizationID,
reason: domain.ContactRevocationVisibilityClosed, at: at,
}); err != nil {
return fmt.Errorf("%s - close contact grants: %w", location, err)
}
return nil
}