Module: Hyrax::User::ClassMethods
- Defined in:
- app/models/concerns/hyrax/user.rb
Instance Method Summary collapse
-
#audit_user ⇒ Object
Override this method if you aren’t using email/password.
- #audit_user_key ⇒ Object
-
#batch_user ⇒ Object
Override this method if you aren’t using email/password.
- #batch_user_key ⇒ Object
- #find_or_create_system_user(user_key) ⇒ Object
- #from_url_component(component) ⇒ Object
- #recent_users(start_date, end_date = nil) ⇒ Object
Instance Method Details
#audit_user ⇒ Object
Override this method if you aren’t using email/password
132 133 134 |
# File 'app/models/concerns/hyrax/user.rb', line 132 def audit_user find_or_create_system_user(audit_user_key) end |
#audit_user_key ⇒ Object
136 137 138 |
# File 'app/models/concerns/hyrax/user.rb', line 136 def audit_user_key Hyrax.config.audit_user_key end |
#batch_user ⇒ Object
Override this method if you aren’t using email/password
141 142 143 |
# File 'app/models/concerns/hyrax/user.rb', line 141 def batch_user find_or_create_system_user(batch_user_key) end |
#batch_user_key ⇒ Object
145 146 147 |
# File 'app/models/concerns/hyrax/user.rb', line 145 def batch_user_key Hyrax.config.batch_user_key end |
#find_or_create_system_user(user_key) ⇒ Object
149 150 151 |
# File 'app/models/concerns/hyrax/user.rb', line 149 def find_or_create_system_user(user_key) User.find_by_user_key(user_key) || User.create!(Devise.authentication_keys.first => user_key, password: Devise.friendly_token[0, 20]) end |
#from_url_component(component) ⇒ Object
153 154 155 |
# File 'app/models/concerns/hyrax/user.rb', line 153 def from_url_component(component) User.find_by_user_key(component.gsub(/-dot-/, '.')) end |
#recent_users(start_date, end_date = nil) ⇒ Object
157 158 159 160 |
# File 'app/models/concerns/hyrax/user.rb', line 157 def recent_users(start_date, end_date = nil) end_date ||= DateTime.current # doing or eq here so that if the user passes nil we still get now User.where(created_at: start_date..end_date) end |