diff --git a/app/assets/templates/admin/invoices/index.html.erb b/app/assets/templates/admin/invoices/index.html.erb index 8f9849e85..6e6eb58c2 100644 --- a/app/assets/templates/admin/invoices/index.html.erb +++ b/app/assets/templates/admin/invoices/index.html.erb @@ -11,7 +11,7 @@
-
+
{{ 'app.admin.invoices.accounting_periods' | translate }} @@ -28,7 +28,7 @@ ui-tour-scroll-parent-id="content-main" post-render="setupInvoicesTour">
-
+
'"> @@ -43,6 +43,10 @@
+ +
+ '"> +
diff --git a/app/policies/accounting_period_policy.rb b/app/policies/accounting_period_policy.rb index 158ee8dc8..bd153c5ef 100644 --- a/app/policies/accounting_period_policy.rb +++ b/app/policies/accounting_period_policy.rb @@ -2,9 +2,13 @@ # Check the access policies for API::AccountingPeriodsController class AccountingPeriodPolicy < ApplicationPolicy - %w[index show create last_closing_end download_archive].each do |action| + %w[index show create download_archive].each do |action| define_method "#{action}?" do user.admin? end end + + def last_closing_end? + user.admin? || user.manager? + end end diff --git a/app/policies/invoice_policy.rb b/app/policies/invoice_policy.rb index 8f3f8953c..0575c16c5 100644 --- a/app/policies/invoice_policy.rb +++ b/app/policies/invoice_policy.rb @@ -1,14 +1,17 @@ +# frozen_string_literal: true + +# Check the access policies for API::InvoicesController class InvoicePolicy < ApplicationPolicy def index? user.admin? end def download? - user.admin? or (record.invoicing_profile.user_id == user.id) + user.admin? || user.manager? || (record.invoicing_profile.user_id == user.id) end def create? - user.admin? + user.admin? || user.manager? end def list?