2020-04-28 16:49:05 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Check the access policies for API::InvoicesController
|
2016-03-23 18:39:41 +01:00
|
|
|
class InvoicePolicy < ApplicationPolicy
|
|
|
|
def index?
|
2019-01-14 12:57:31 +01:00
|
|
|
user.admin?
|
2016-03-23 18:39:41 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def download?
|
2020-04-28 16:49:05 +02:00
|
|
|
user.admin? || user.manager? || (record.invoicing_profile.user_id == user.id)
|
2016-03-23 18:39:41 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def create?
|
2020-04-28 16:49:05 +02:00
|
|
|
user.admin? || user.manager?
|
2016-03-23 18:39:41 +01:00
|
|
|
end
|
2016-05-31 10:02:27 +02:00
|
|
|
|
|
|
|
def list?
|
2020-04-28 16:35:54 +02:00
|
|
|
user.admin? || user.manager?
|
2016-05-31 10:02:27 +02:00
|
|
|
end
|
2019-07-31 12:00:52 +02:00
|
|
|
|
|
|
|
def first?
|
|
|
|
user.admin?
|
|
|
|
end
|
2016-03-23 18:39:41 +01:00
|
|
|
end
|