Class: UserPolicy
- Inherits:
-
ApplicationPolicy
- Object
- ApplicationPolicy
- UserPolicy
- Defined in:
- app/policies/user_policy.rb
Overview
Authorizes access to User objects
Instance Method Summary collapse
-
#create? ⇒ false
(also: #new?)
Users only are created via invitation.
-
#destroy? ⇒ Boolean
Whether or not the user is a staff member.
-
#edit? ⇒ Boolean
(also: #update?)
Whether or not the user is editing his/her own user record.
-
#index? ⇒ false
We don't allow all users to be enumerated.
-
#show? ⇒ true
Anyone can view any user's profile.
Methods inherited from ApplicationPolicy
Constructor Details
This class inherits a constructor from ApplicationPolicy
Instance Method Details
#create? ⇒ false Also known as: new?
Returns users only are created via invitation
16 17 18 |
# File 'app/policies/user_policy.rb', line 16 def create? false end |
#destroy? ⇒ Boolean
Returns whether or not the user is a staff member
30 31 32 |
# File 'app/policies/user_policy.rb', line 30 def destroy? organization_user.staff? end |
#edit? ⇒ Boolean Also known as: update?
Returns whether or not the user is editing his/her own user record
23 24 25 |
# File 'app/policies/user_policy.rb', line 23 def edit? self? || organization_user.staff? end |
#index? ⇒ false
Note:
will change when we build a separate admin UI
Returns we don't allow all users to be enumerated
6 7 8 |
# File 'app/policies/user_policy.rb', line 6 def index? false end |
#show? ⇒ true
Returns anyone can view any user's profile
11 12 13 |
# File 'app/policies/user_policy.rb', line 11 def show? true end |