Module: SyncAttrWithAuth0::Adapters::ActiveRecord::Validation
- Included in:
- SyncAttrWithAuth0::Adapters::ActiveRecord
- Defined in:
- lib/sync_attr_with_auth0/adapters/active_record/validation.rb
Instance Method Summary collapse
-
#users_in_auth0_with_matching_email ⇒ Object
validate_email_with_auth0.
- #validate_email_with_auth0 ⇒ Object
- #validate_email_with_auth0? ⇒ Boolean
- #validate_with_auth0? ⇒ Boolean
Instance Method Details
#users_in_auth0_with_matching_email ⇒ Object
validate_email_with_auth0
24 25 26 |
# File 'lib/sync_attr_with_auth0/adapters/active_record/validation.rb', line 24 def users_in_auth0_with_matching_email return SyncAttrWithAuth0::Auth0.find_users_by_email("\"#{auth0_user_email}\"", exclude_user_id: auth0_user_uid, config: auth0_sync_configuration) end |
#validate_email_with_auth0 ⇒ Object
18 19 20 21 22 |
# File 'lib/sync_attr_with_auth0/adapters/active_record/validation.rb', line 18 def validate_email_with_auth0 return true unless validate_email_with_auth0? return users_in_auth0_with_matching_email.empty? end |
#validate_email_with_auth0? ⇒ Boolean
11 12 13 14 15 |
# File 'lib/sync_attr_with_auth0/adapters/active_record/validation.rb', line 11 def validate_email_with_auth0? email_changed_method_name = "#{auth0_sync_configuration.email_attribute.to_s}_changed?" !!(validate_with_auth0? and self.send(email_changed_method_name)) end |
#validate_with_auth0? ⇒ Boolean
6 7 8 |
# File 'lib/sync_attr_with_auth0/adapters/active_record/validation.rb', line 6 def validate_with_auth0? !!((self.respond_to?(:validate_with_auth0) and !self.validate_with_auth0.nil?) ? self.validate_with_auth0 : true) end |