Project

General

Profile

Actions

Bug #80901

closed

Missing workspace causes exception when "Edit Live" flag is cleared in user settings

Added by Ralph-Diether Marzusch Marzusch almost 7 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Workspaces
Target version:
-
Start date:
2017-04-20
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
8
PHP Version:
7.1
Tags:
Complexity:
Is Regression:
Yes
Sprint Focus:

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';


Related issues 3 (0 open3 closed)

Related to TYPO3 Core - Bug #52104: Exception: No such workspace definedClosedNicole Cordes2013-09-18

Actions
Related to TYPO3 Core - Bug #82626: Problem with users without access to LIVE workspaceClosed2017-10-01

Actions
Related to TYPO3 Core - Task #75546: [EXAMPLE] User authentication classesClosedMorton Jonuschat2016-04-12

Actions
Actions

Also available in: Atom PDF