1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-10 21:24:20 +01:00
fab-manager/app/policies/training_policy.rb

27 lines
439 B
Ruby
Raw Normal View History

2020-04-27 17:28:11 +02:00
# frozen_string_literal: true
# Check the access policies for API::TrainingsController
2016-03-23 18:39:41 +01:00
class TrainingPolicy < ApplicationPolicy
class Scope < Scope
def resolve
scope.includes(:plans, :machines)
2016-03-23 18:39:41 +01:00
end
end
2020-05-15 23:36:43 +02:00
def create?
2020-04-27 17:28:11 +02:00
user.admin?
end
def update?
user.admin? || user.manager?
2016-03-23 18:39:41 +01:00
end
def destroy?
2020-04-27 17:28:11 +02:00
user.admin? && record.destroyable?
2016-03-23 18:39:41 +01:00
end
def availabilities?
2020-04-27 17:28:11 +02:00
user.admin? || user.manager?
end
2016-03-23 18:39:41 +01:00
end