blob: f7b03b0b5c01354d9975c5c93951fe2e11a20523 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
class LinePolicy < ApplicationPolicy
class Scope < Scope
def resolve
scope
end
end
def create?
user.has_permission?('lines.create')
end
def destroy?
user.has_permission?('lines.destroy')
end
def deactivate?
!record.deactivated? && user.has_permission?('lines.change_status')
end
def activate?
record.deactivated? && user.has_permission?('lines.change_status')
end
def update?
user.has_permission?('lines.update')
end
def create_footnote?
!referential_read_only? && organisation_match? && user.has_permission?('footnotes.create')
end
def edit_footnote?
!referential_read_only? && organisation_match? && user.has_permission?('footnotes.update')
end
def destroy_footnote?
!referential_read_only? && organisation_match? && user.has_permission?('footnotes.destroy')
end
def update_footnote? ; edit_footnote? end
def new_footnote? ; create_footnote? end
end
|