From 3297eff3c1c63a40090cd88d36cc6b096919e2be Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 25 Jan 2024 11:57:49 +0100 Subject: [PATCH] [BUGFIX] Properly initialize backend user for requests Default requests won't have a workspace id. That will lead to TYPO3 defaults -99 id. That in turn will lead to being in preview mode once a backend user is provided within context. We therefore cover the default and turn it into live workspace which could be the expected default. Also we add missing initialization for backend user. Resolves: #535 --- .../json_response/Classes/Middleware/BackendUserHandler.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Resources/Core/Functional/Extensions/json_response/Classes/Middleware/BackendUserHandler.php b/Resources/Core/Functional/Extensions/json_response/Classes/Middleware/BackendUserHandler.php index 1b002c1d..860bbab6 100644 --- a/Resources/Core/Functional/Extensions/json_response/Classes/Middleware/BackendUserHandler.php +++ b/Resources/Core/Functional/Extensions/json_response/Classes/Middleware/BackendUserHandler.php @@ -55,6 +55,10 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface // Init backend user if found in database $backendUser = GeneralUtility::makeInstance(FrontendBackendUserAuthentication::class); $backendUser->user = $row; + $backendUser->uc = isset($row['uc']) ? unserialize($row['uc']) : []; + $backendUser->initializeUserSessionManager(); + $backendUser->fetchGroupData(); + $workspaceId = $workspaceId ?? 0; if ($workspaceId !== null) { // Force backend user into given workspace, can be 0, too. $backendUser->setTemporaryWorkspace($workspaceId);