Class: LoginActivityPolicy
Instance Attribute Summary
#current_user, #record
Instance Method Summary
collapse
#admin?, #initialize, #staff?, #staff_member?
Instance Method Details
#create? ⇒ Boolean
24
25
26
|
# File 'lib/kowl/templates/app/policies/login_activity_policy.rb', line 24
def create?
edit?
end
|
#destroy? ⇒ Boolean
32
33
34
|
# File 'lib/kowl/templates/app/policies/login_activity_policy.rb', line 32
def destroy?
edit?
end
|
#edit? ⇒ Boolean
All audit logs should not be modifiable, by any means
16
17
18
|
# File 'lib/kowl/templates/app/policies/login_activity_policy.rb', line 16
def edit?
false
end
|
#index? ⇒ Boolean
11
12
13
|
# File 'lib/kowl/templates/app/policies/login_activity_policy.rb', line 11
def index?
admin? || current_user.id == record.user_id
end
|
#new? ⇒ Boolean
20
21
22
|
# File 'lib/kowl/templates/app/policies/login_activity_policy.rb', line 20
def new?
edit?
end
|
#show? ⇒ Boolean
4
5
6
7
8
9
|
# File 'lib/kowl/templates/app/policies/login_activity_policy.rb', line 4
def show?
admin? || (staff? && record.user.role != 'superuser') || (staff_member? && current_user.id == record.user_id)
end
|
#update? ⇒ Boolean
28
29
30
|
# File 'lib/kowl/templates/app/policies/login_activity_policy.rb', line 28
def update?
edit?
end
|