Bug #80901
closedMissing workspace causes exception when "Edit Live" flag is cleared in user settings
100%
Description
Possibly related to https://forge.typo3.org/issues/52104 ?
Summary:¶
If "Workspace Management" is enabled the backend will try to display the workspace titles in the workspace menu.
There seems to be "fallback" code to switch to the "live" workspace if the currently selected workspace does not exist.
However, if the "Edit live" flag is cleared for this user, there ist no live workspace for this user that would be selectable.
=> This causes an exception when the backend tries to display the workspace title in the workspace selection box.
=> This happens not only if there is no more workspace that the user is assigned to, but also if there is another workspace (with the user assigned as "Member").
It seems there is only a fallback to -99 (live workspace).
Steps to reproduce the problem:¶
(note 1)
- Create non-admin test-user
- In Tab "Mounts and Workspaces" UNCHECK "Edit live (online)"
- Login to BE using this user (it helps to have 2 different browers, one for admin access, one for test-user access) => everything should be ok
- Enable extension "Workspace Management" (note 4)
- Refresh test-user browser (note 2)
- Create workspace
- Assign user to "Members" list within workspace
- Look at database table "be_user", field "workspace_id" => should now be the id of previously created workspace
- Refresh test-user browser (note 2)
- Now remove the workspace
- Look at database table "be_user", field "workspace_id" => should still be set to the previously assigned workspace id
- Refresh test-user browser => this will show an exception (see below)
- Look at database table "be_user", field "workspace_id" => should now be set to -99 (= live workspace)
From this point it is no longer possible to use the BE as this user (note 3). Even restarting the browser will not help.
(note 1) This was a fresh install of TYPO3 8.7.0, no upgrade.
(note 2) When I first tried creating a workspace and assigning a user, the problem occured even without having removed any workspace! Could this be related to the order of actions (created user first, and enabled extension afterwards -- possibly "workspace_id" set to -99 initially, but if "Edit live" is deselected (= db field "workspace_perms" = 0) this entry would be invalid?]
(note 3) Assigning "Admin" flag to the user or deactivating the "Workspace Management" extension will allow the user to work/login again [because this gives access to live editing], but will not fix the problem permanently.
Workaround to fix the problem from the backend UI:¶
Either:
- Create a new workspace
- Assign test-user to "Owners" of this workspace (note 5)
- Look at database table "be_user", field "workspace_id" => should still be set to -99 - Refresh test-user browser => backend works again (note 6)
- Look at database table "be_user", field "workspace_id" => now set to the new workspace id (inconsistency is fixed) - Assign test-user to "Members" of this workspace
or:
- Edit the user and CHECK the "Edit live" flag
- Refresh test-user browser => backend works again (even without any workspace)
- Select a workspace (note 7)
- Turn off "Edit live" again
(note 4) This problem will only appear if "Edit live" is UNCHECKED (= db field "workspace_perms" = 0)
(note 5 and 6) These are the important steps: assigning the user to "Members" will not fix the problem, it is necessary to assign the user to "Owners" temporarily and then accessing the backend once.
(note 7) Without manual selection of another workspace the problem re-appears when turning "Edit live" off again
Exception traceback:¶
Uncaught TYPO3 Exception
1476045469: No such workspace defined (More information)
InvalidArgumentException thrown in file
/Volumes/Work1/MAMP/test3/typo3_src-8.7.0/typo3/sysext/workspaces/Classes/Service/WorkspaceService.php in line 128.
14 TYPO3\CMS\Workspaces\Service\WorkspaceService::getWorkspaceTitle(-99)
/Volumes/Work1/MAMP/test3/typo3_src-8.7.0/typo3/sysext/workspaces/Classes/Backend/ToolbarItems/WorkspaceSelectorToolbarItem.php:
00041:
00042: $pageRenderer = $this->getPageRenderer();
00043: $pageRenderer->addInlineLanguageLabel('Workspaces.workspaceTitle', WorkspaceService::getWorkspaceTitle($this->getBackendUser()->workspace));
00044: $pageRenderer->loadRequireJsModule('TYPO3/CMS/Workspaces/Toolbar/WorkspacesMenu');
00045: }
13 TYPO3\CMS\Workspaces\Backend\ToolbarItems\WorkspaceSelectorToolbarItem::__construct()
/Volumes/Work1/MAMP/test3/typo3_src-8.7.0/typo3/sysext/core/Classes/Utility/GeneralUtility.php:
03890: }
03891: // Create new instance and call constructor with parameters
03892: $instance = new $finalClassName(...$constructorArguments);
03893: // Register new singleton instance
03894: if ($instance instanceof SingletonInterface) {
12 TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance("TYPO3\CMS\Workspaces\Backend\ToolbarItems\WorkspaceSelectorToolbarItem")
/Volumes/Work1/MAMP/test3/typo3_src-8.7.0/typo3/sysext/backend/Classes/Controller/BackendController.php:
00225: $classNameRegistry = $GLOBALS['TYPO3_CONF_VARS']['BE']['toolbarItems'];
00226: foreach ($classNameRegistry as $className) {
00227: $toolbarItemInstance = GeneralUtility::makeInstance($className);
00228: if (!$toolbarItemInstance instanceof ToolbarItemInterface) {
00229: throw new \RuntimeException(
11 TYPO3\CMS\Backend\Controller\BackendController::initializeToolbarItems()
/Volumes/Work1/MAMP/test3/typo3_src-8.7.0/typo3/sysext/backend/Classes/Controller/BackendController.php:
00172: $this->css = '';
00173:
00174: $this->initializeToolbarItems();
00175: $this->executeHook('constructPostProcess');
00176: $this->includeLegacyBackendItems();
10 TYPO3\CMS\Backend\Controller\BackendController::__construct()
/Volumes/Work1/MAMP/test3/typo3_src-8.7.0/typo3/sysext/core/Classes/Utility/GeneralUtility.php:
03890: }
03891: // Create new instance and call constructor with parameters
03892: $instance = new $finalClassName(...$constructorArguments);
03893: // Register new singleton instance
03894: if ($instance instanceof SingletonInterface) {
9 TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance("TYPO3\CMS\Backend\Controller\BackendController")
/Volumes/Work1/MAMP/test3/typo3_src-8.7.0/typo3/sysext/core/Classes/Http/Dispatcher.php:
00072: if (is_string($target) && strpos($target, '::') !== false) {
00073: list($className, $methodName) = explode('::', $target, 2);
00074: $targetObject = GeneralUtility::makeInstance($className);
00075: return [$targetObject, $methodName];
00076: }
8 TYPO3\CMS\Core\Http\Dispatcher::getCallableFromTarget("TYPO3\CMS\Backend\Controller\BackendController::mainAction")
/Volumes/Work1/MAMP/test3/typo3_src-8.7.0/typo3/sysext/backend/Classes/Http/RouteDispatcher.php:
00051:
00052: $targetIdentifier = $route->getOption('target');
00053: $target = $this->getCallableFromTarget($targetIdentifier);
00054: return call_user_func_array($target, [$request, $response]);
00055: }
7 TYPO3\CMS\Backend\Http\RouteDispatcher::dispatch(TYPO3\CMS\Core\Http\ServerRequest, TYPO3\CMS\Core\Http\Response)
/Volumes/Work1/MAMP/test3/typo3_src-8.7.0/typo3/sysext/backend/Classes/Http/RequestHandler.php:
00138: /** @var RouteDispatcher $dispatcher */
00139: $dispatcher = GeneralUtility::makeInstance(RouteDispatcher::class);
00140: return $dispatcher->dispatch($request, $response);
00141: }
00142: }
6 TYPO3\CMS\Backend\Http\RequestHandler::dispatch(TYPO3\CMS\Core\Http\ServerRequest)
/Volumes/Work1/MAMP/test3/typo3_src-8.7.0/typo3/sysext/backend/Classes/Http/RequestHandler.php:
00070: // Check if the router has the available route and dispatch.
00071: try {
00072: return $this->dispatch($request);
00073:
00074: // When token was invalid redirect to login
5 TYPO3\CMS\Backend\Http\RequestHandler::handleRequest(TYPO3\CMS\Core\Http\ServerRequest)
/Volumes/Work1/MAMP/test3/typo3_src-8.7.0/typo3/sysext/core/Classes/Core/Bootstrap.php:
00308:
00309: // Execute the command which returns a Response object or NULL
00310: $this->response = $requestHandler->handleRequest($request);
00311: return $this;
00312: }
4 TYPO3\CMS\Core\Core\Bootstrap::handleRequest(TYPO3\CMS\Core\Http\ServerRequest)
/Volumes/Work1/MAMP/test3/typo3_src-8.7.0/typo3/sysext/backend/Classes/Http/Application.php:
00090: }
00091:
00092: $this->bootstrap->handleRequest($this->request);
00093:
00094: if ($execute !== null) {
3 TYPO3\CMS\Backend\Http\Application::run()
/Volumes/Work1/MAMP/test3/typo3_src-8.7.0/typo3/sysext/backend/Resources/Private/Php/backend.php:
00022: $classLoader = require DIR . '/../../../../../../vendor/autoload.php';
00023:
00024: (new \TYPO3\CMS\Backend\Http\Application($classLoader))->run();
00025: });
2 {closure}()
/Volumes/Work1/MAMP/test3/typo3_src-8.7.0/typo3/sysext/backend/Resources/Private/Php/backend.php:
00023:
00024: (new \TYPO3\CMS\Backend\Http\Application($classLoader))->run();
00025: });
1 require("/Volumes/Work1/MAMP/test3/typo3_src-8.7.0/typo3/sysext/backend/Resources/Private/Php/backend.php")
/Volumes/Work1/MAMP/test3/typo3_src-8.7.0/typo3/index.php:
00001: 00002:
00003: require DIR . '/sysext/backend/Resources/Private/Php/backend.php';
Updated by Ralph-Diether Marzusch Marzusch almost 8 years ago
- Related to Bug #52104: Exception: No such workspace defined added
Updated by Ralph-Diether Marzusch Marzusch almost 8 years ago
- Project changed from 9 to TYPO3 Core
- Category set to Workspaces
- TYPO3 Version set to 8
- PHP Version set to 7.1
Changed "Project" to "Core" [sri, I'm new to typo3.org and don't know which is the right project...]
Updated by Michael Kasten almost 8 years ago
- Priority changed from Should have to Must have
Confirmed this issue here!
try to create a workspace setting on two different installations (both 8.7.0)
If you create the workspaces following available documentations you will end with a unusable backend!
The second workaround will help me:
1) Login with your admin account, create a new user, leave the Edit Live Option checked!
2) Login in with the user (use a different Browser so the admin account still exists) should be have the restricition to the edit workspace
3) The user have to change to the Edit Workspace
4) Go to your admin account browser window, select the new be user and uncheck the Edit Live Option.
5) Go to your user browser window and refresh them, you just will see only the edit workspace (expected behaviour)
Logfile
Core: Exception handler (WEB): Uncaught TYPO3 Exception: #1476045469: No such workspace defined | InvalidArgumentException thrown in file /home/cosmo/LOCALHOST/TYPO3CORE/typo3_src-8.7.0/typo3/sysext/workspaces/Classes/Service/WorkspaceService.php in line 128. Requested URL: http://localhost/TYPO3-8-dev/typo3/index.php?route=%2Fmain&token=7ffb1f6bdada70358782b4dc01b0dc145edec1ac
Updated by Marcelo Vetter over 7 years ago
I can confirm the problem.
The second workaround suggest also solves the problem for me, but for every new user, I have to remember to follow the steps :(
Any possibility for this to be fixed for the next patch (8.7.5)?
Updated by Dima Nozdrin over 7 years ago
It's logically that if workspace management is enabled, each BE user should be either an admin or a member of a workspace (at least one). If such conditions meet the requirements, the next changes fix the bug.
In file /typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php on line 2248 change
$workspaces = $queryBuilder->select('uid', 'title', 'adminusers', 'reviewers')
to
$workspaces = $queryBuilder->select('uid', 'title', 'adminusers', 'members', 'reviewers')
This changes will lead to the behavior like in TYPO3 7.6
Updated by Riccardo De Contardi over 7 years ago
- Related to Bug #82626: Problem with users without access to LIVE workspace added
Updated by Anke Altintop over 7 years ago
Dima your solution worked for me. Could you commit this to Gerrit? See https://docs.typo3.org/typo3cms/ContributionWorkflowGuide/ for instructions.
Updated by Gerrit Code Review about 7 years ago
- Status changed from New to Under Review
Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55251
Updated by Oliver Hader about 7 years ago
- Related to Task #75546: [EXAMPLE] User authentication classes added
Updated by Gerrit Code Review about 7 years ago
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55309
Updated by Gerrit Code Review about 7 years ago
Patch set 2 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55251
Updated by Gerrit Code Review about 7 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55309
Updated by Gerrit Code Review about 7 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55309
Updated by Gerrit Code Review about 7 years ago
Patch set 3 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55251
Updated by Dima Nozdrin about 7 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 39bfde43ed6456a08bb5ae6c4642c682cbd59cc8.
Updated by Georg Ringer 9 months ago
- Related to Bug #97129: No such workspace defined after create a new user and assigning usergroups to users added