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
94 95 96 |
# File 'app/models/concerns/sufia/user.rb', line 94 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
99 100 101 |
# File 'app/models/concerns/sufia/user.rb', line 99 def audituser_key '[email protected]' end |
#batchuser ⇒ Object
Override this method if you aren’t using email/password
104 105 106 |
# File 'app/models/concerns/sufia/user.rb', line 104 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
109 110 111 |
# File 'app/models/concerns/sufia/user.rb', line 109 def batchuser_key '[email protected]' end |
#current ⇒ Object
85 86 87 |
# File 'app/models/concerns/sufia/user.rb', line 85 def current Thread.current[:user] end |
#current=(user) ⇒ Object
89 90 91 |
# File 'app/models/concerns/sufia/user.rb', line 89 def current=(user) Thread.current[:user] = user end |
#from_url_component(component) ⇒ Object
113 114 115 |
# File 'app/models/concerns/sufia/user.rb', line 113 def from_url_component(component) User.find_by_user_key(component.gsub(/-dot-/, '.')) end |
#permitted_attributes ⇒ Object
78 79 80 81 82 83 |
# File 'app/models/concerns/sufia/user.rb', line 78 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] end |