From bc5ac942c9970d87e46336865a40f90697bc8916 Mon Sep 17 00:00:00 2001 From: Raul Gracia Date: Tue, 24 Oct 2023 09:24:49 +0100 Subject: [PATCH] Fix rubocop offenses --- app/controllers/system_admin/applicants_controller.rb | 2 +- app/controllers/system_admin/reports_controller.rb | 4 ++-- config/locales/en.yml | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/system_admin/applicants_controller.rb b/app/controllers/system_admin/applicants_controller.rb index 7710a630..86944e00 100644 --- a/app/controllers/system_admin/applicants_controller.rb +++ b/app/controllers/system_admin/applicants_controller.rb @@ -66,7 +66,7 @@ def find_applicant def check_user_roles unless current_user.has_role?(:servant) - redirect_to(root_path, alert: "You do not have permission to access this page") + redirect_to(root_path, alert: t("errors.access_denied")) end end end diff --git a/app/controllers/system_admin/reports_controller.rb b/app/controllers/system_admin/reports_controller.rb index 9df937ef..830ca9f3 100644 --- a/app/controllers/system_admin/reports_controller.rb +++ b/app/controllers/system_admin/reports_controller.rb @@ -21,11 +21,11 @@ def check_user_roles case params[:id] when "home_office", "standing_data", "payroll" unless current_user.has_role?(:manager) - redirect_to(root_path, alert: "You do not have permission to access this page") + redirect_to(root_path, alert: t("errors.access_denied")) end when "applications", "qa" unless current_user.has_role?(:admin) - redirect_to(root_path, alert: "You do not have permission to access this page") + redirect_to(root_path, alert: t("errors.access_denied")) end end end diff --git a/config/locales/en.yml b/config/locales/en.yml index b7f6cb3d..78ead4b5 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -48,3 +48,5 @@ en: success: 'User was successfully removed.' omniauth_callbacks: no_account: 'You have not yet an account!' + errors: + access_denied: 'You do not have permission to access this page'