Class: Organizations::AllowlistEntry
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Organizations::AllowlistEntry
- Defined in:
- lib/organizations/models/allowlist_entry.rb
Overview
A pre-approved email address on an organization's roster/allowlist, used for verified joining when the organization has no email domain of its own (clubs, associations, mixed-provider orgs).
A user who proves control of a rostered inbox (emailed code) becomes a verified member and the entry is marked claimed. Proof-of-control is still required — a leaked roster must never grant membership without inbox access.
Entries are typically bulk-imported: see Organization#import_allowlist!.
Instance Method Summary collapse
-
#claim!(user) ⇒ self
Mark this entry as consumed by a user's membership.
- #claimed? ⇒ Boolean
Instance Method Details
#claim!(user) ⇒ self
Mark this entry as consumed by a user's membership. Idempotent: claiming an already-claimed entry is a no-op.
64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/organizations/models/allowlist_entry.rb', line 64 def claim!(user) return self if claimed? with_lock do break if claimed? update!(claimed_at: Time.current, claimed_by_id: user.id) end self end |
#claimed? ⇒ Boolean
56 57 58 |
# File 'lib/organizations/models/allowlist_entry.rb', line 56 def claimed? claimed_at.present? end |