Class: UserVerification
Class Method Summary
collapse
Instance Method Summary
collapse
descendants_using_encryption, lockbox_options, #timestamp_attributes_for_update_in_model, #valid?
Class Method Details
.find_by_type!(type, identifier) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'app/models/user_verification.rb', line 16
def self.find_by_type!(type, identifier)
user_verification =
case type
when SAML::User::LOGINGOV_CSID
find_by(logingov_uuid: identifier)
when SAML::User::IDME_CSID
find_by(idme_uuid: identifier)
when SAML::User::MHV_ORIGINAL_CSID
find_by(mhv_uuid: identifier)
when SAML::User::DSLOGON_CSID
find_by(dslogon_uuid: identifier)
end
raise ActiveRecord::RecordNotFound unless user_verification
user_verification
end
|
Instance Method Details
#backing_credential_identifier ⇒ Object
57
58
59
|
# File 'app/models/user_verification.rb', line 57
def backing_credential_identifier
logingov_uuid || idme_uuid || backing_idme_uuid
end
|
#backing_uuid_credentials ⇒ Object
All credentials require either an idme_uuid or logingov_uuid, mhv/dslogon credential types store the backing idme_uuid as backing_idme_uuid
73
74
75
76
77
|
# File 'app/models/user_verification.rb', line 73
def backing_uuid_credentials
unless idme_uuid || logingov_uuid || backing_idme_uuid
errors.add(:base, 'Must define either an idme_uuid, logingov_uuid, or backing_idme_uuid')
end
end
|
#credential_identifier ⇒ Object
53
54
55
|
# File 'app/models/user_verification.rb', line 53
def credential_identifier
idme_uuid || logingov_uuid || mhv_uuid || dslogon_uuid
end
|
#credential_type ⇒ Object
#lock! ⇒ Object
33
34
35
|
# File 'app/models/user_verification.rb', line 33
def lock!
update!(locked: true)
end
|
#single_credential_identifier ⇒ Object
XOR operators between the four credential identifiers mean one, and only one, of these can be defined, If two or more are defined, or if none are defined, then a validation error is raised
65
66
67
68
69
|
# File 'app/models/user_verification.rb', line 65
def single_credential_identifier
unless idme_uuid.present? ^ logingov_uuid.present? ^ mhv_uuid.present? ^ dslogon_uuid.present?
errors.add(:base, 'Must specify one, and only one, credential identifier')
end
end
|
#unlock! ⇒ Object
37
38
39
|
# File 'app/models/user_verification.rb', line 37
def unlock!
update!(locked: false)
end
|
#verified? ⇒ Boolean
41
42
43
|
# File 'app/models/user_verification.rb', line 41
def verified?
verified_at.present? && user_account.verified?
end
|