Class: Renalware::UserPolicy
- Inherits:
-
BasePolicy
- Object
- ApplicationPolicy
- BasePolicy
- Renalware::UserPolicy
- Defined in:
- app/policies/renalware/user_policy.rb
Instance Attribute Summary
Attributes inherited from ApplicationPolicy
Instance Method Summary collapse
Methods inherited from BasePolicy
#contact_added?, #create?, #debug?, #destroy?, #index?, #initialize, #show?, #sort?
Methods inherited from ApplicationPolicy
#create?, #destroy?, #edit?, #index?, #initialize, #new?, #scope, #show?
Constructor Details
This class inherits a constructor from Renalware::BasePolicy
Instance Method Details
#assign_role?(role) ⇒ Boolean
9 10 11 12 13 14 15 16 17 18 |
# File 'app/policies/renalware/user_policy.rb', line 9 def assign_role?(role) return false if role.hidden can_assign_role = case role.name when "devops", "super_admin" then false when "admin" then user_is_super_admin? else true end can_assign_role && update? end |
#update? ⇒ Boolean
5 6 7 |
# File 'app/policies/renalware/user_policy.rb', line 5 def update? super && !user_update_self? end |