diff options
Diffstat (limited to 'app/policies/time_table_policy.rb')
| -rw-r--r-- | app/policies/time_table_policy.rb | 32 | 
1 files changed, 32 insertions, 0 deletions
| diff --git a/app/policies/time_table_policy.rb b/app/policies/time_table_policy.rb new file mode 100644 index 000000000..4638eabd8 --- /dev/null +++ b/app/policies/time_table_policy.rb @@ -0,0 +1,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 | 
