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

13 lines
322 B
Ruby
Raw Normal View History

# frozen_string_literal: true
# Check the access policies for API::ReservationsController
2016-03-23 18:39:41 +01:00
class ReservationPolicy < ApplicationPolicy
2019-09-09 17:37:54 +02:00
def create?
user.admin? || (user.manager? && record.user_id != user.id) || record.price.zero?
2019-09-09 17:37:54 +02:00
end
2016-03-23 18:39:41 +01:00
def update?
user.admin? || user.manager? || record.user == user
2016-03-23 18:39:41 +01:00
end
end