From ec565e01a7ba62eb8a227a8597c33a8416e5f39f Mon Sep 17 00:00:00 2001 From: Benni Mack <benni@typo3.org> Date: Fri, 2 Oct 2020 14:35:46 +0200 Subject: [PATCH] [TASK] Remove leftover "draft workspace" checks A magic draft workspace (wsid=-1) was removed during TYPO3 v4.x development already, with custom workspaces (wsid>0) available since a long time. Some left-over checks can safely be removed now. Resolves: #92474 Releases: master Change-Id: Ia38a4f0d8099673d933678f0533601c5b85bcde6 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/66000 Tested-by: Oliver Bartsch <bo@cedev.de> Tested-by: TYPO3com <noreply@typo3.com> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Oliver Bartsch <bo@cedev.de> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> --- typo3/sysext/backend/Classes/Module/ModuleLoader.php | 5 ++--- .../Classes/Authentication/BackendUserAuthentication.php | 1 - .../sysext/info/Classes/Controller/InfoModuleController.php | 5 ++--- .../Controller/TypoScriptTemplateModuleController.php | 4 +++- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/typo3/sysext/backend/Classes/Module/ModuleLoader.php b/typo3/sysext/backend/Classes/Module/ModuleLoader.php index a5eb2336f70c..1bd3fbdc4fa7 100644 --- a/typo3/sysext/backend/Classes/Module/ModuleLoader.php +++ b/typo3/sysext/backend/Classes/Module/ModuleLoader.php @@ -284,9 +284,8 @@ class ModuleLoader } $status = true; if (!empty($MCONF['workspaces'])) { - $status = $this->BE_USER->workspace === 0 && GeneralUtility::inList($MCONF['workspaces'], 'online') - || $this->BE_USER->workspace === -1 && GeneralUtility::inList($MCONF['workspaces'], 'offline') - || $this->BE_USER->workspace > 0 && GeneralUtility::inList($MCONF['workspaces'], 'custom'); + $status = ($this->BE_USER->workspace === 0 && GeneralUtility::inList($MCONF['workspaces'], 'online')) + || ($this->BE_USER->workspace > 0 && GeneralUtility::inList($MCONF['workspaces'], 'custom')); } elseif ($this->BE_USER->workspace === -99) { $status = false; } diff --git a/typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php b/typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php index e57e85f90e3a..98d46aaf121a 100644 --- a/typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php +++ b/typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php @@ -454,7 +454,6 @@ class BackendUserAuthentication extends AbstractUserAuthentication !empty($conf['workspaces']) && ExtensionManagementUtility::isLoaded('workspaces') && ($this->workspace !== 0 || !GeneralUtility::inList($conf['workspaces'], 'online')) - && ($this->workspace !== -1 || !GeneralUtility::inList($conf['workspaces'], 'offline')) && ($this->workspace <= 0 || !GeneralUtility::inList($conf['workspaces'], 'custom')) ) { throw new \RuntimeException('Workspace Error: This module "' . $conf['name'] . '" is not available under the current workspace', 1294586447); diff --git a/typo3/sysext/info/Classes/Controller/InfoModuleController.php b/typo3/sysext/info/Classes/Controller/InfoModuleController.php index 55efdd21ce93..682c1eb0ba2e 100644 --- a/typo3/sysext/info/Classes/Controller/InfoModuleController.php +++ b/typo3/sysext/info/Classes/Controller/InfoModuleController.php @@ -380,9 +380,8 @@ class InfoModuleController if (is_array($mergeArray)) { $backendUser = $this->getBackendUser(); foreach ($mergeArray as $k => $v) { - if (((string)$v['ws'] === '' || $backendUser->workspace === 0 && GeneralUtility::inList($v['ws'], 'online')) - || $backendUser->workspace === -1 && GeneralUtility::inList($v['ws'], 'offline') - || $backendUser->workspace > 0 && GeneralUtility::inList($v['ws'], 'custom') + if (((string)$v['ws'] === '' || ($backendUser->workspace === 0 && GeneralUtility::inList($v['ws'], 'online'))) + || ($backendUser->workspace > 0 && GeneralUtility::inList($v['ws'], 'custom')) ) { $menuArr[$k] = $this->getLanguageService()->sL($v['title']); } diff --git a/typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateModuleController.php b/typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateModuleController.php index ae843fb3f3f6..020d57cdba12 100644 --- a/typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateModuleController.php +++ b/typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateModuleController.php @@ -666,7 +666,9 @@ page.10.value = HELLO WORLD! $mergeArray = $GLOBALS['TBE_MODULES_EXT'][$modName]['MOD_MENU'][$menuKey]; if (is_array($mergeArray)) { foreach ($mergeArray as $k => $v) { - if (((string)$v['ws'] === '' || $this->getBackendUser()->workspace === 0 && GeneralUtility::inList($v['ws'], 'online')) || $this->getBackendUser()->workspace === -1 && GeneralUtility::inList($v['ws'], 'offline') || $this->getBackendUser()->workspace > 0 && GeneralUtility::inList($v['ws'], 'custom')) { + if (((string)$v['ws'] === '' || ($this->getBackendUser()->workspace === 0 && GeneralUtility::inList($v['ws'], 'online'))) + || ($this->getBackendUser()->workspace > 0 && GeneralUtility::inList($v['ws'], 'custom')) + ) { $menuArr[$k] = $this->getLanguageService()->sL($v['title']); } } -- GitLab