aboutsummaryrefslogtreecommitdiffstats
path: root/app/policies/time_table_policy.rb
blob: 4638eabd826cfb3b3c39337367d834187e7ad51c (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
  class TimeTablePolicy < ApplicationPolicy

    class Scope < Scope
      def resolve
        scope
      end
    end

    def create?
      !archived? && organisation_match? && user.has_permission?('time_tables.create')
    end

    def destroy?
      !archived? && organisation_match? && user.has_permission?('time_tables.destroy')
    end

    def update?
      !archived? && organisation_match? && user.has_permission?('time_tables.update')
    end

    def actualize?
      !archived? && organisation_match? && edit?
    end

    def duplicate?
      !archived? && organisation_match? && create?
    end

    def month?
      update?
    end
  end