Module: Hyrax::User::ClassMethods
- Defined in:
- app/models/concerns/hyrax/user.rb
Instance Method Summary collapse
- #audit_user ⇒ Object
- #audit_user_key ⇒ Object
- #batch_user ⇒ Object
- #batch_user_key ⇒ Object
- #find_or_create_system_user(user_key) ⇒ Object
- #from_agent_key(key) ⇒ Object
- #from_url_component(component) ⇒ Object
- #recent_users(start_date, end_date = nil) ⇒ Object
- #system_user ⇒ Object
- #system_user_key ⇒ Object
- #user_key_field ⇒ Object
Instance Method Details
#audit_user ⇒ Object
163 164 165 |
# File 'app/models/concerns/hyrax/user.rb', line 163 def audit_user find_or_create_system_user(audit_user_key) end |
#audit_user_key ⇒ Object
167 168 169 |
# File 'app/models/concerns/hyrax/user.rb', line 167 def audit_user_key Hyrax.config.audit_user_key end |
#batch_user ⇒ Object
175 176 177 |
# File 'app/models/concerns/hyrax/user.rb', line 175 def batch_user find_or_create_system_user(batch_user_key) end |
#batch_user_key ⇒ Object
179 180 181 |
# File 'app/models/concerns/hyrax/user.rb', line 179 def batch_user_key Hyrax.config.batch_user_key end |
#find_or_create_system_user(user_key) ⇒ Object
183 184 185 |
# File 'app/models/concerns/hyrax/user.rb', line 183 def find_or_create_system_user(user_key) User.find_by_user_key(user_key) || User.create!(user_key_field => user_key, password: Devise.friendly_token[0, 20]) end |
#from_agent_key(key) ⇒ Object
187 188 189 |
# File 'app/models/concerns/hyrax/user.rb', line 187 def from_agent_key(key) User.find_by_user_key(key) end |
#from_url_component(component) ⇒ Object
191 192 193 |
# File 'app/models/concerns/hyrax/user.rb', line 191 def from_url_component(component) User.find_by_user_key(component.gsub(/-dot-/, '.')) end |
#recent_users(start_date, end_date = nil) ⇒ Object
195 196 197 198 |
# File 'app/models/concerns/hyrax/user.rb', line 195 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 |
#system_user ⇒ Object
155 156 157 |
# File 'app/models/concerns/hyrax/user.rb', line 155 def system_user find_or_create_system_user(system_user_key) end |
#system_user_key ⇒ Object
159 160 161 |
# File 'app/models/concerns/hyrax/user.rb', line 159 def system_user_key Hyrax.config.system_user_key end |
#user_key_field ⇒ Object
171 172 173 |
# File 'app/models/concerns/hyrax/user.rb', line 171 def user_key_field Hydra.config.user_key_field end |