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
124 125 126 |
# File 'app/models/concerns/sufia/user.rb', line 124 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
129 130 131 |
# File 'app/models/concerns/sufia/user.rb', line 129 def audituser_key '[email protected]' end |
#batchuser ⇒ Object
Override this method if you aren’t using email/password
134 135 136 |
# File 'app/models/concerns/sufia/user.rb', line 134 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
139 140 141 |
# File 'app/models/concerns/sufia/user.rb', line 139 def batchuser_key '[email protected]' end |
#current ⇒ Object
115 116 117 |
# File 'app/models/concerns/sufia/user.rb', line 115 def current Thread.current[:user] end |
#current=(user) ⇒ Object
119 120 121 |
# File 'app/models/concerns/sufia/user.rb', line 119 def current=(user) Thread.current[:user] = user end |
#from_url_component(component) ⇒ Object
143 144 145 |
# File 'app/models/concerns/sufia/user.rb', line 143 def from_url_component(component) User.find_by_user_key(component.gsub(/-dot-/, '.')) end |
#permitted_attributes ⇒ Object
106 107 108 109 110 111 112 113 |
# File 'app/models/concerns/sufia/user.rb', line 106 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, :remove_avatar, :orcid ] end |