2019-09-11 11:51:04 +02:00
|
|
|
# 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?
|
2020-04-27 12:12:29 +02:00
|
|
|
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?
|
2020-04-27 12:12:29 +02:00
|
|
|
user.admin? || user.manager? || record.user == user
|
2016-03-23 18:39:41 +01:00
|
|
|
end
|
2023-06-27 17:50:47 +02:00
|
|
|
|
|
|
|
def confirm_payment?
|
|
|
|
user.admin? || user.manager?
|
|
|
|
end
|
2016-03-23 18:39:41 +01:00
|
|
|
end
|