blob: a8f54ad483f5d7249dc7ad32edc8287082ce49a7 (
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
|
class TimeTablePolicy < BoivPolicy
class Scope < Scope
def resolve
scope
end
end
def actualize?
!archived? && organisation_match? && edit?
end
def create?
!archived? && user.has_permission?('time_tables.create') # organisation match via referential is checked in the view
end
def edit?
!archived? && organisation_match? && user.has_permission?('time_tables.edit')
end
def destroy?
!archived? && organisation_match? && user.has_permission?('time_tables.destroy')
end
def duplicate?
!archived? && organisation_match? && create?
end
def update? ; edit? end
def new? ; create? end
end
|