Class: UserPolicy
Instance Attribute Summary
Attributes inherited from Policy
#record, #user
Instance Method Summary
collapse
Methods inherited from Policy
collection, for, #initialize, member
#index, #update?
Constructor Details
This class inherits a constructor from Policy
Instance Method Details
#change_password? ⇒ Boolean
48
49
50
|
# File 'app/policies/user_policy.rb', line 48
def change_password?
user == record
end
|
#create? ⇒ Boolean
16
17
18
|
# File 'app/policies/user_policy.rb', line 16
def create?
new?
end
|
#deactivated? ⇒ Boolean
8
9
10
|
# File 'app/policies/user_policy.rb', line 8
def deactivated?
index?
end
|
#delete_image? ⇒ Boolean
36
37
38
|
# File 'app/policies/user_policy.rb', line 36
def delete_image?
edit?
end
|
#destroy? ⇒ Boolean
44
45
46
|
# File 'app/policies/user_policy.rb', line 44
def destroy?
user.role?(:users)
end
|
#edit? ⇒ Boolean
28
29
30
|
# File 'app/policies/user_policy.rb', line 28
def edit?
user == record || user.role?(:users)
end
|
#index? ⇒ Boolean
4
5
6
|
# File 'app/policies/user_policy.rb', line 4
def index?
true
end
|
#login? ⇒ Boolean
20
21
22
|
# File 'app/policies/user_policy.rb', line 20
def login?
true
end
|
#manage? ⇒ Boolean
24
25
26
|
# File 'app/policies/user_policy.rb', line 24
def manage?
new?
end
|
#new? ⇒ Boolean
12
13
14
|
# File 'app/policies/user_policy.rb', line 12
def new?
User.none? || user.role?(:users)
end
|
#policies? ⇒ Boolean
40
41
42
|
# File 'app/policies/user_policy.rb', line 40
def policies?
user.role?(:users)
end
|
#show? ⇒ Boolean
32
33
34
|
# File 'app/policies/user_policy.rb', line 32
def show?
edit?
end
|