Module: Sufia::User::ClassMethods
- Defined in:
- app/models/concerns/sufia/user.rb
Instance Method Summary collapse
-
#audituser ⇒ Object
Override this method if you aren’t using email/password.
-
#audituser_key ⇒ Object
Override this method if you aren’t using email as the userkey.
-
#batchuser ⇒ Object
Override this method if you aren’t using email/password.
-
#batchuser_key ⇒ Object
Override this method if you aren’t using email as the userkey.
- #current ⇒ Object
- #current=(user) ⇒ Object
- #from_url_component(component) ⇒ Object
- #permitted_attributes ⇒ Object
Instance Method Details
#audituser ⇒ Object
Override this method if you aren’t using email/password
84 85 86 |
# File 'app/models/concerns/sufia/user.rb', line 84 def audituser User.find_by_user_key(audituser_key) || User.create!(Devise.authentication_keys.first => audituser_key, password: Devise.friendly_token[0,20]) end |
#audituser_key ⇒ Object
Override this method if you aren’t using email as the userkey
89 90 91 |
# File 'app/models/concerns/sufia/user.rb', line 89 def audituser_key '[email protected]' end |
#batchuser ⇒ Object
Override this method if you aren’t using email/password
94 95 96 |
# File 'app/models/concerns/sufia/user.rb', line 94 def batchuser User.find_by_user_key(batchuser_key) || User.create!(Devise.authentication_keys.first => batchuser_key, password: Devise.friendly_token[0,20]) end |
#batchuser_key ⇒ Object
Override this method if you aren’t using email as the userkey
99 100 101 |
# File 'app/models/concerns/sufia/user.rb', line 99 def batchuser_key '[email protected]' end |
#current ⇒ Object
75 76 77 |
# File 'app/models/concerns/sufia/user.rb', line 75 def current Thread.current[:user] end |
#current=(user) ⇒ Object
79 80 81 |
# File 'app/models/concerns/sufia/user.rb', line 79 def current=(user) Thread.current[:user] = user end |
#from_url_component(component) ⇒ Object
103 104 105 |
# File 'app/models/concerns/sufia/user.rb', line 103 def from_url_component(component) User.find_by_user_key(component.gsub(/-dot-/, '.')) end |
#permitted_attributes ⇒ Object
68 69 70 71 72 73 |
# File 'app/models/concerns/sufia/user.rb', line 68 def permitted_attributes [:email, :login, :display_name, :address, :admin_area, :department, :title, :office, :chat_id, :website, :affiliation, :telephone, :avatar, :group_list, :groups_last_update, :facebook_handle, :twitter_handle, :googleplus_handle, :linkedin_handle] end |