From 02d6ba7d529bc62b3f5759d2a4867b7e4c8f0386 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Sun, 25 Jun 2023 01:13:57 -0700 Subject: [PATCH] Standalone - Generate proper HTTP response code for permission-errors `E2E_Core_ErrorTest` checks for HTTP response codes on permission-errors * Before: Sends HTTP 200. Tests for `frontend_permission` and `backend_permission` fails. * After: Sends HTTP 403. Tests for `frontend_permission` and `backend_permission` passes. --- CRM/Utils/System/Standalone.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CRM/Utils/System/Standalone.php b/CRM/Utils/System/Standalone.php index 88e3d4a87e..3c842063e9 100644 --- a/CRM/Utils/System/Standalone.php +++ b/CRM/Utils/System/Standalone.php @@ -544,4 +544,10 @@ class CRM_Utils_System_Standalone extends CRM_Utils_System_Base { return Security::singleton()->getCMSPermissionsUrlParams(); } + public function permissionDenied() { + http_response_code(403); + echo "403 Forbidden: You do not have permission to access this resource.\n"; + // TODO: Prettier error page + } + } -- 2.25.1