Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] Do not end up in workspace and preview for default requests #536

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
/** @var InternalRequestContext $internalRequestContext */
$internalRequestContext = $request->getAttribute('typo3.testing.context');
$backendUserId = $internalRequestContext->getBackendUserId();
$workspaceId = $internalRequestContext->getWorkspaceId();
$workspaceId = $internalRequestContext->getWorkspaceId() ?? 0;

if ((int)$backendUserId === 0) {
// Skip if $backendUserId is invalid, typically null or 0
Expand All @@ -55,10 +55,10 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
// Init backend user if found in database
$backendUser = GeneralUtility::makeInstance(FrontendBackendUserAuthentication::class);
$backendUser->user = $row;
if ($workspaceId !== null) {
// Force backend user into given workspace, can be 0, too.
$backendUser->setTemporaryWorkspace($workspaceId);
}
$backendUser->uc = isset($row['uc']) ? unserialize($row['uc']) : [];
$backendUser->initializeUserSessionManager();
$backendUser->fetchGroupData();
$backendUser->setTemporaryWorkspace($workspaceId);
$GLOBALS['BE_USER'] = $backendUser;
$this->setBackendUserAspect(GeneralUtility::makeInstance(Context::class), $backendUser);
}
Expand Down