2021-01-25 17:42:30 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Check the access policies for API::PaymentSchedulesController
|
|
|
|
class PaymentSchedulePolicy < ApplicationPolicy
|
2022-01-17 12:38:53 +01:00
|
|
|
%w[list? cash_check? confirm_transfer? cancel? update?].each do |action|
|
2021-02-09 12:09:26 +01:00
|
|
|
define_method action do
|
|
|
|
user.admin? || user.manager?
|
|
|
|
end
|
2021-01-25 17:42:30 +01:00
|
|
|
end
|
|
|
|
|
2022-01-03 11:24:08 +01:00
|
|
|
%w[refresh_item? download? pay_item? show_item?].each do |action|
|
2021-02-09 12:09:26 +01:00
|
|
|
define_method action do
|
|
|
|
user.admin? || user.manager? || (record.invoicing_profile.user_id == user.id)
|
|
|
|
end
|
2021-01-25 17:42:30 +01:00
|
|
|
end
|
|
|
|
end
|