Class: UserPolicy
Instance Attribute Summary
#current_user, #record
Instance Method Summary
collapse
#admin?, #initialize, #staff?, #staff_member?
Instance Method Details
#create? ⇒ Boolean
13
14
15
|
# File 'lib/kowl/templates/app/policies/user_policy.rb', line 13
def create?
false
end
|
#destroy? ⇒ Boolean
35
36
37
38
|
# File 'lib/kowl/templates/app/policies/user_policy.rb', line 35
def destroy?
admin? && current_user.id != record.id
end
|
#edit? ⇒ Boolean
31
32
33
|
# File 'lib/kowl/templates/app/policies/user_policy.rb', line 31
def edit?
update?
end
|
#impersonate? ⇒ Boolean
40
41
42
|
# File 'lib/kowl/templates/app/policies/user_policy.rb', line 40
def impersonate?
admin? && current_user.id != record.id
end
|
#index? ⇒ Boolean
4
5
6
|
# File 'lib/kowl/templates/app/policies/user_policy.rb', line 4
def index?
admin?
end
|
#new? ⇒ Boolean
Account should not be create-able, unless someone is explicitly signing up to create an account
9
10
11
|
# File 'lib/kowl/templates/app/policies/user_policy.rb', line 9
def new?
false
end
|
#show? ⇒ Boolean
17
18
19
20
21
22
|
# File 'lib/kowl/templates/app/policies/user_policy.rb', line 17
def show?
admin? || (staff? && record.role != 'superuser') || (staff_member? && current_user.id == record.id)
end
|
#update? ⇒ Boolean
24
25
26
27
28
29
|
# File 'lib/kowl/templates/app/policies/user_policy.rb', line 24
def update?
admin? || (staff? && record.role != 'superuser') || (staff_member? && current_user.id == record.id)
end
|