blob: 2539175091c00bae4aac3bce5b4b2e4e8a0f2be5 (
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
|
class ReferentialPolicy < ApplicationPolicy
class Scope < Scope
def resolve
scope
end
end
def create?
user.has_permission?('referentials.create')
end
def destroy?
!archived? && organisation_match? && user.has_permission?('referentials.destroy')
end
def update?
!archived? && organisation_match? && user.has_permission?('referentials.update')
end
def clone?
!archived? && create?
end
def validate?
!archived? && create? && organisation_match?
end
def archive?
record.archived_at.nil? && organisation_match? && user.has_permission?('referentials.update')
end
def unarchive?
!record.archived_at.nil? && organisation_match? && user.has_permission?('referentials.update')
end
def common_lines?
# TODO: Replace with correct BL ASA available, c.f. https://projects.af83.io/issues/2692
true
end
end
|