-
-
Notifications
You must be signed in to change notification settings - Fork 222
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
BUG: (9.0) User Workspace is null
if first login to the site happens via "/neos/switch/to/..."
#4401
Comments
Same issue is when someone logged into neos before there was a site, and if afterwards a site will be created. The session is already authenticated so the zookeeper doesnt create a user workspace. Currently the backend controller redirects to the login page https://github.com/neos/neos-ui/blob/369d27ab664d985b4f352eaabdc3b993719faa9c/Classes/Controller/BackendController.php#L155 in the hope that a user workspace will be created but, in reality we just crated a nice endless redirect loop. To fix this i implemented the following instead of the redirect: if (!$workspace) {
// if a neos login session was active before the site was imported the EditorContentStreamZookeper was not able to create a user workspace. In that case we will do this here:
$baseWorkspace = $contentRepository->getWorkspaceFinder()->findOneByName(WorkspaceName::forLive());
if (!$baseWorkspace) {
throw new NoHomepageException();
}
$editorsNewContentStreamId = ContentStreamId::create();
$contentRepository->handle(
CreateWorkspace::create(
$workspaceName,
$baseWorkspace->workspaceName,
new WorkspaceTitle((string) $user->getName()),
new WorkspaceDescription(''),
$editorsNewContentStreamId,
UserId::fromString($this->persistenceManager->getIdentifierByObject($user))
)
)->block();
$workspace = $contentRepository->getWorkspaceFinder()->findOneByName(
$workspaceName
);
} but what speaks against creating a workspace in the neos ui backend controller in general and remove the zookeeper? tltr: i want to create a user workspace only on demand directly in |
This will hopefully resolved with #5146 |
… user with id" after `cr:prune` and site switching - After `cr:prune` all sessions are destroyed to enforce a fresh login. The login will then create the missing personal workspace if needed. - During site:switch it is checked wether the new site has a personal workspace for the current user and create this if missing Resolves: neos#4566 Relates: neos#4401
I found the
EditorContentStreamZooKeeper
to be responsible for creating user workspaces upon authentication when they do not exist yet.For this purpose the
relayEditorAuthentication
method ofEditorContentStreamZookeeper
is registered as a signal handler forAuthenticationProviderManager::authenticatedToken
:neos-development-collection/Neos.Neos/Classes/Package.php
Lines 137 to 142 in 093cd64
If a user logs in via the form at
/neos/login
, this mechanism works perfectly.In a multi-site setup however, the user may log in via
/neos/login
atsite-a
and then switches tosite-b
via the main menu by clicking on the link that leads to/neos/switch/to/site-b
.EditorContentStreamZooKeeper::relayEditorAuthentication
does not capture this, so if the user doesn't have a user workspace atsite-b
already, it won't be created automatically in this case. The user is now trapped in an infinite redirect loop due to:https://github.com/neos/neos-ui/blob/283a073b4b49ea20742067ef2d567516cabd9534/Classes/Controller/BackendController.php#L150-L156
I don't know what exactly needs to be fixed here. I looks to me as if
LoginController::tokenLoginAction
shouldn't cirumvent theAuthenticationProviderManager::authenticatedToken
signal. But I have to admit that I have no idea what is supposed to happen here 😅Related: #4590
The text was updated successfully, but these errors were encountered: