From ff4e11ba974542b14566089bbf0beb444623aa7e Mon Sep 17 00:00:00 2001 From: Sebastien Marinier Date: Tue, 23 Apr 2024 18:41:35 +0200 Subject: [PATCH] - register IsGeneralManagerMiddleware - return good type with afterException (JSONresponse) --- lib/AppInfo/Application.php | 2 ++ lib/Middleware/IsGeneralManagerMiddleware.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 471f72086..2d6fd7669 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -67,5 +67,7 @@ public function register(IRegistrationContext $context): void { $context->registerMiddleware(WorkspaceAccessControlMiddleware::class); $context->registerMiddleware(IsSpaceAdminMiddleware::class); + $context->registerMiddleware(IsGeneralManagerMiddleware::class); } + } diff --git a/lib/Middleware/IsGeneralManagerMiddleware.php b/lib/Middleware/IsGeneralManagerMiddleware.php index b36a66bb3..346899770 100644 --- a/lib/Middleware/IsGeneralManagerMiddleware.php +++ b/lib/Middleware/IsGeneralManagerMiddleware.php @@ -52,7 +52,7 @@ public function beforeController($controller, $methodName): void { return; } - public function afterException($controller, $methodName, Exception $exception): void { + public function afterException($controller, $methodName, Exception $exception): JSONResponse { if ($exception instanceof AccessDeniedException) { return new JSONResponse([ 'status' => 'forbidden',