Skip to content

Commit

Permalink
Make only Global admin and Global Billing admin allowed (#4590)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeticiaErrandonea authored Sep 20, 2024
1 parent f632520 commit 0d7f489
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class FacilityAccountsReconciliationController < ApplicationController
before_action :check_acting_as
before_action :init_current_facility
before_action :check_billing_access
before_action :check_billing_access_to_mark_as_unrecoverable
before_action :set_billing_navigation

def index
Expand Down Expand Up @@ -81,4 +82,10 @@ def unreconciled_details
OrderDetail.complete.statemented(current_facility)
end

def check_billing_access_to_mark_as_unrecoverable
if params[:order_status] == "unrecoverable" && !(current_user.administrator? || current_user.global_billing_administrator?)
flash[:error] = t("controllers.facility_accounts_reconciliation.cannot_mark_as_unrecoverable")
redirect_to([account_route.to_sym, :facility_accounts])
end
end
end
3 changes: 3 additions & 0 deletions config/locales/en.controllers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ en:
success: "Payment source activated successfully"
failure: "Cannot activate. %{errors}"

facility_accounts_reconciliation:
cannot_mark_as_unrecoverable: "You do not have permission to mark payments as unrecoverable. Please contact your Global Administrator for help."

facility_notifications:
no_selection: No orders selected
errors_html: We experienced the following errors. Please try again.<br/>%{errors}
Expand Down

0 comments on commit 0d7f489

Please sign in to comment.