Class: Spotlight::Role
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Spotlight::Role
- Defined in:
- app/models/spotlight/role.rb
Overview
Exhibit authorization roles
Constant Summary collapse
- ROLES =
%w(admin curator).freeze
Instance Method Summary collapse
- #user_key ⇒ Object
-
#user_key=(key) ⇒ Object
setting user key causes the user to get set.
Instance Method Details
#user_key ⇒ Object
18 19 20 21 22 23 24 |
# File 'app/models/spotlight/role.rb', line 18 def user_key if user @user_key = user.user_key else @user_key end end |
#user_key=(key) ⇒ Object
setting user key causes the user to get set
27 28 29 30 31 32 |
# File 'app/models/spotlight/role.rb', line 27 def user_key=(key) @user_key = key self.user ||= Spotlight::Engine.user_class.find_by_user_key(key) self.user ||= Spotlight::Engine.user_class.invite!(email: user_key, skip_invitation: true) user.user_key = key end |