[TASK] Deprecate getTSConfigVal() and getTSConfigProp() 53/56953/11
authorChristian Kuhn <lolli@schwarzbu.ch>
Sun, 13 May 2018 12:15:40 +0000 (14:15 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Sun, 13 May 2018 20:28:49 +0000 (22:28 +0200)
The patch deprecates BackendUserAuthentication->getTSConfigVal()
and ->getTSConfigProp() and adapts usages to rely on getTSConfig()
without arguments. The array nesting is done directly within
consuming code and is combined with ?? to a fallback value.
Advantages:
* Expensive and recursive string operations within
  getTSConfig() are not used anymore.
* The weird 'value' / 'property' based sub array
  juggling is gone.
* Full TSconfig path including fallback can be easily
  seen within consuming code
* Notice free array access using null coalescence operator

Change-Id: I6d5777ebd533dcfdc6018e0226bfb3e513cfa652
Resolves: #84993
Related: #84982
Releases: master
Reviewed-on: https://review.typo3.org/56953
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
55 files changed:
typo3/sysext/adminpanel/Classes/Middleware/AdminPanelInitiator.php
typo3/sysext/adminpanel/Classes/Modules/AbstractModule.php
typo3/sysext/adminpanel/Classes/Modules/EditModule.php
typo3/sysext/backend/Classes/Backend/ToolbarItems/ClearCacheToolbarItem.php
typo3/sysext/backend/Classes/Backend/ToolbarItems/ShortcutToolbarItem.php
typo3/sysext/backend/Classes/Clipboard/Clipboard.php
typo3/sysext/backend/Classes/ContextMenu/ItemProviders/AbstractProvider.php
typo3/sysext/backend/Classes/ContextMenu/ItemProviders/PageProvider.php
typo3/sysext/backend/Classes/ContextMenu/ItemProviders/RecordProvider.php
typo3/sysext/backend/Classes/Controller/BackendController.php
typo3/sysext/backend/Classes/Controller/EditDocumentController.php
typo3/sysext/backend/Classes/Controller/LoginController.php
typo3/sysext/backend/Classes/Controller/NewRecordController.php
typo3/sysext/backend/Classes/Controller/Page/NewMultiplePagesController.php
typo3/sysext/backend/Classes/Controller/Page/TreeController.php
typo3/sysext/backend/Classes/Controller/SimpleDataHandlerController.php
typo3/sysext/backend/Classes/Domain/Repository/Module/BackendModuleRepository.php
typo3/sysext/backend/Classes/Form/FormResultCompiler.php
typo3/sysext/backend/Classes/Tree/View/AbstractTreeView.php
typo3/sysext/backend/Classes/Tree/View/BrowseTreeView.php
typo3/sysext/backend/Classes/Utility/BackendUtility.php
typo3/sysext/backend/Classes/View/PageLayoutView.php
typo3/sysext/backend/Tests/Unit/Controller/LoginControllerTest.php
typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php
typo3/sysext/core/Classes/DataHandling/DataHandler.php
typo3/sysext/core/Documentation/Changelog/master/Deprecation-84993-DeprecateSomeTSconfigRelatedMethods.rst [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Authentication/BackendUserAuthenticationTest.php
typo3/sysext/documentation/Classes/Controller/DocumentController.php
typo3/sysext/feedit/Classes/FrontendEditPanel.php
typo3/sysext/feedit/Classes/Middleware/FrontendEditInitiator.php
typo3/sysext/filelist/Classes/Controller/FileListController.php
typo3/sysext/form/Classes/Controller/FormEditorController.php
typo3/sysext/impexp/Classes/ContextMenu/ItemProvider.php
typo3/sysext/impexp/Classes/Controller/ImportExportController.php
typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallMatcher.php
typo3/sysext/opendocs/Classes/Backend/ToolbarItems/OpendocsToolbarItem.php
typo3/sysext/recordlist/Classes/Browser/DatabaseBrowser.php
typo3/sysext/recordlist/Classes/Browser/FileBrowser.php
typo3/sysext/recordlist/Classes/Controller/AbstractLinkBrowserController.php
typo3/sysext/recordlist/Classes/LinkHandler/AbstractLinkHandler.php
typo3/sysext/recordlist/Classes/LinkHandler/FileLinkHandler.php
typo3/sysext/recordlist/Classes/LinkHandler/PageLinkHandler.php
typo3/sysext/recordlist/Classes/LinkHandler/RecordLinkHandler.php
typo3/sysext/recordlist/Classes/RecordList/AbstractDatabaseRecordList.php
typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php
typo3/sysext/recordlist/Classes/View/FolderUtilityRenderer.php
typo3/sysext/recycler/Classes/Controller/RecyclerAjaxController.php
typo3/sysext/recycler/Classes/Controller/RecyclerModuleController.php
typo3/sysext/setup/Classes/Controller/SetupModuleController.php
typo3/sysext/taskcenter/Classes/Controller/TaskModuleController.php
typo3/sysext/viewpage/Classes/Controller/ViewModuleController.php
typo3/sysext/workspaces/Classes/Controller/PreviewController.php
typo3/sysext/workspaces/Classes/Controller/Remote/MassActionHandler.php
typo3/sysext/workspaces/Classes/DataHandler/CommandMap.php
typo3/sysext/workspaces/Classes/Preview/PreviewUriBuilder.php

index b0dba87..e4ee084 100644 (file)
@@ -47,7 +47,7 @@ class AdminPanelInitiator implements MiddlewareInterface
             // Initialize admin panel since simulation settings are required here
             $beUser = $GLOBALS['BE_USER'];
             // set legacy config
-            $beUser->extAdminConfig = $beUser->getTSConfigProp('admPanel');
+            $beUser->extAdminConfig = $beUser->getTSConfig()['admPanel.'] ?? [];
             $adminPanelConfiguration = $beUser->extAdminConfig;
             if (isset($adminPanelConfiguration['enable.'])) {
                 foreach ($adminPanelConfiguration['enable.'] as $value) {
index 2dbb5d9..a66fa8f 100644 (file)
@@ -39,7 +39,7 @@ abstract class AbstractModule implements AdminPanelModuleInterface
 
     public function __construct()
     {
-        $this->mainConfiguration = $this->getBackendUser()->getTSConfigProp('admPanel');
+        $this->mainConfiguration = $this->getBackendUser()->getTSConfig()['admPanel.'] ?? [];
     }
 
     /**
index a6cbbdf..56e194a 100644 (file)
@@ -74,11 +74,8 @@ class EditModule extends AbstractModule
      */
     private function getPageModule(): string
     {
-        $newPageModule = \trim(
-            (string)$this->getBackendUser()
-                ->getTSConfigVal('options.overridePageModule')
-        );
-        return BackendUtility::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
+        $pageModule = \trim($this->getBackendUser()->getTSConfig()['options.']['overridePageModule'] ?? '');
+        return BackendUtility::isModuleSetInTBE_MODULES($pageModule) ? $pageModule : 'web_layout';
     }
 
     /**
index bd123e0..e79f2de 100644 (file)
@@ -46,11 +46,12 @@ class ClearCacheToolbarItem implements ToolbarItemInterface
     public function __construct()
     {
         $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/Toolbar/ClearCacheMenu');
-        $backendUser = $this->getBackendUser();
-
+        $isAdmin = $this->getBackendUser()->isAdmin();
+        $userTsConfig = $this->getBackendUser()->getTSConfig();
         $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
+
         // Clear all page-related caches
-        if ($backendUser->isAdmin() || $backendUser->getTSConfigVal('options.clearCache.pages')) {
+        if ($isAdmin || $userTsConfig['options.']['clearCache.']['pages'] ?? false) {
             $this->cacheActions[] = [
                 'id' => 'pages',
                 'title' => 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:flushPageCachesTitle',
@@ -64,7 +65,9 @@ class ClearCacheToolbarItem implements ToolbarItemInterface
         // Clearing of all caches is only shown if explicitly enabled via TSConfig
         // or if BE-User is admin and the TSconfig explicitly disables the possibility for admins.
         // This is useful for big production systems where admins accidentally could slow down the system.
-        if ($backendUser->getTSConfigVal('options.clearCache.all') || ($backendUser->isAdmin() && $backendUser->getTSConfigVal('options.clearCache.all') !== '0')) {
+        if ($userTsConfig['options.']['clearCache.']['all'] ?? false
+            || ($isAdmin && (bool)($userTsConfig['options.']['clearCache.']['all'] ?? true))
+        ) {
             $this->cacheActions[] = [
                 'id' => 'all',
                 'title' => 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:flushAllCachesTitle2',
@@ -97,7 +100,7 @@ class ClearCacheToolbarItem implements ToolbarItemInterface
             return true;
         }
         foreach ($this->optionValues as $value) {
-            if ($backendUser->getTSConfigVal('options.clearCache.' . $value)) {
+            if ($backendUser->getTSConfig()['options.']['clearCache.'][$value] ?? false) {
                 return true;
             }
         }
index 1607a3f..f989794 100644 (file)
@@ -125,7 +125,7 @@ class ShortcutToolbarItem implements ToolbarItemInterface
      */
     public function checkAccess()
     {
-        return (bool)$this->getBackendUser()->getTSConfigVal('options.enableBookmarks');
+        return (bool)($this->getBackendUser()->getTSConfig()['options.']['enableBookmarks'] ?? false);
     }
 
     /**
@@ -392,7 +392,7 @@ class ShortcutToolbarItem implements ToolbarItemInterface
         $languageService = $this->getLanguageService();
         $backendUser = $this->getBackendUser();
         // Groups from TSConfig
-        $bookmarkGroups = $backendUser->getTSConfigProp('options.bookmarkGroups');
+        $bookmarkGroups = $backendUser->getTSConfig()['options.']['bookmarkGroups.'] ?? [];
         if (is_array($bookmarkGroups) && !empty($bookmarkGroups)) {
             foreach ($bookmarkGroups as $groupId => $label) {
                 if (!empty($label)) {
index a2a5588..5d83e01 100644 (file)
@@ -114,13 +114,10 @@ class Clipboard
      */
     public function initializeClipboard()
     {
+        $userTsConfig = $this->getBackendUser()->getTSConfig();
         // Get data
-        $clipData = $this->getBackendUser()->getModuleData('clipboard', $this->getBackendUser()->getTSConfigVal('options.saveClipboard') ? '' : 'ses');
-        // NumberTabs
-        $clNP = $this->getBackendUser()->getTSConfigVal('options.clipboardNumberPads');
-        if (MathUtility::canBeInterpretedAsInteger($clNP) && $clNP >= 0) {
-            $this->numberTabs = MathUtility::forceIntegerInRange($clNP, 0, 20);
-        }
+        $clipData = $this->getBackendUser()->getModuleData('clipboard', $userTsConfig['options.']['saveClipboard'] ? '' : 'ses');
+        $this->numberTabs = MathUtility::forceIntegerInRange((int)($userTsConfig['options.']['clipboardNumberPads'] ?? 3), 0, 20);
         // Resets/reinstates the clipboard pads
         $this->clipData['normal'] = is_array($clipData['normal']) ? $clipData['normal'] : [];
         for ($a = 1; $a <= $this->numberTabs; $a++) {
index c0ed264..2e93d4b 100644 (file)
@@ -144,7 +144,11 @@ class AbstractProvider implements ProviderInterface
     protected function initDisabledItems()
     {
         $TSkey = $this->table . ($this->context ? '.' . $this->context : '');
-        $this->disabledItems = GeneralUtility::trimExplode(',', $this->backendUser->getTSConfigVal('options.contextMenu.table.' . $TSkey . '.disableItems'), true);
+        $this->disabledItems = GeneralUtility::trimExplode(
+            ',',
+            $this->backendUser->getTSConfig()['options.']['contextMenu.']['table.'][$TSkey . '.']['disableItems'] ?? '',
+            true
+        );
     }
 
     /**
index 1489617..1216105 100644 (file)
@@ -402,7 +402,7 @@ class PageProvider extends RecordProvider
     protected function canClearCache(): bool
     {
         return !$this->isRoot()
-            && ($this->backendUser->isAdmin() || $this->backendUser->getTSConfigVal('options.clearCache.pages'));
+            && ($this->backendUser->isAdmin() || $this->backendUser->getTSConfig()['options.']['clearCache.']['pages'] ?? false);
     }
 
     /**
index 5675dcc..51898b1 100644 (file)
@@ -460,9 +460,8 @@ class RecordProvider extends AbstractProvider
      */
     protected function canShowHistory(): bool
     {
-        $showHistoryTS = $this->backendUser->getTSConfig('options.showHistory');
-        $showHistory = (bool)trim($showHistoryTS['properties'][$this->table] ?? $showHistoryTS['value'] ?? '1');
-        return $showHistory;
+        $userTsConfig = $this->backendUser->getTSConfig();
+        return (bool)(\trim($userTsConfig['options.']['showHistory.'][$this->table] ?? $userTsConfig['options.']['showHistory'] ?? '1'));
     }
 
     /**
index c8a02dc..62b713f 100644 (file)
@@ -391,7 +391,7 @@ class BackendController
         $this->pageRenderer->addInlineSetting('DateTimePicker', 'DateFormat', $dateFormat);
 
         // If another page module was specified, replace the default Page module with the new one
-        $newPageModule = trim($beUser->getTSConfigVal('options.overridePageModule'));
+        $newPageModule = trim($beUser->getTSConfig()['options.']['overridePageModule'] ?? '');
         $pageModule = BackendUtility::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
         if (!$beUser->check('modules', $pageModule)) {
             $pageModule = '';
@@ -432,6 +432,7 @@ class BackendController
     protected function handlePageEditing()
     {
         $beUser = $this->getBackendUser();
+        $userTsConfig = $this->getBackendUser()->getTSConfig();
         // EDIT page:
         $editId = preg_replace('/[^[:alnum:]_]/', '', GeneralUtility::_GET('edit'));
         if ($editId) {
@@ -474,8 +475,8 @@ class BackendController
        window.setTimeout("top.loadEditId(' . (int)$editRecord['uid'] . ');", 500);
                        ';
                 // Checking page edit parameter:
-                if (!$beUser->getTSConfigVal('options.bookmark_onEditId_dontSetPageTree')) {
-                    $bookmarkKeepExpanded = $beUser->getTSConfigVal('options.bookmark_onEditId_keepExistingExpanded');
+                if (!($userTsConfig['options.']['bookmark_onEditId_dontSetPageTree'] ?? false)) {
+                    $bookmarkKeepExpanded = (bool)($userTsConfig['options.']['bookmark_onEditId_keepExistingExpanded'] ?? false);
                     // Expanding page tree:
                     BackendUtility::openPageTree((int)$editRecord['pid'], !$bookmarkKeepExpanded);
                 }
index af7879e..1293665 100644 (file)
@@ -647,7 +647,7 @@ class EditDocumentController
         $tce->setControl($parsedBody['control'] ?? $queryParams['control'] ?? []);
 
         // Set default values specific for the user
-        $TCAdefaultOverride = $beUser->getTSConfigProp('TCAdefaults');
+        $TCAdefaultOverride = $beUser->getTSConfig()['TCAdefaults.'] ?? null;
         if (is_array($TCAdefaultOverride)) {
             $tce->setDefaultsFromUserTS($TCAdefaultOverride);
         }
index 782cc2f..43d4611 100644 (file)
@@ -309,7 +309,8 @@ class LoginController implements LoggerAwareInterface
      */
     protected function checkRedirect(ServerRequestInterface $request): void
     {
-        if (empty($this->getBackendUserAuthentication()->user['uid'])) {
+        $backendUser = $this->getBackendUserAuthentication();
+        if (empty($backendUser->user['uid'])) {
             return;
         }
 
@@ -331,7 +332,7 @@ class LoginController implements LoggerAwareInterface
             // try it once again - that might be needed for auto login
             $this->redirectToURL = 'index.php?commandLI=setCookie';
         }
-        $redirectToUrl = (string)$this->getBackendUserAuthentication()->getTSConfigVal('auth.BE.redirectToURL');
+        $redirectToUrl = (string)($backendUser->getTSConfig()['auth.']['BE.']['redirectToURL'] ?? '');
         if (empty($redirectToUrl)) {
             // Based on the interface we set the redirect script
             $parsedBody = $request->getParsedBody();
@@ -351,8 +352,8 @@ class LoginController implements LoggerAwareInterface
             $interface = '';
         }
         // store interface
-        $this->getBackendUserAuthentication()->uc['interfaceSetup'] = $interface;
-        $this->getBackendUserAuthentication()->writeUC();
+        $backendUser->uc['interfaceSetup'] = $interface;
+        $backendUser->writeUC();
 
         $formProtection = FormProtectionFactory::get();
         if (!$formProtection instanceof BackendFormProtection) {
index feb5569..76daa15 100644 (file)
@@ -337,15 +337,14 @@ class NewRecordController
         // Page-selection permission clause (reading)
         $this->perms_clause = $beUser->getPagePermsClause(Permission::PAGE_SHOW);
         // This will hide records from display - it has nothing to do with user rights!!
-        if ($pidList = $beUser->getTSConfigVal('options.hideRecords.pages')) {
-            if (!empty($pidList)) {
-                $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
-                    ->getQueryBuilderForTable('pages');
-                $this->perms_clause .= ' AND ' . $queryBuilder->expr()->notIn(
-                    'pages.uid',
-                    GeneralUtility::intExplode(',', $pidList)
-                );
-            }
+        $pidList = $beUser->getTSConfig()['options.']['hideRecords.']['pages'] ?? '';
+        if (!empty($pidList)) {
+            $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
+                ->getQueryBuilderForTable('pages');
+            $this->perms_clause .= ' AND ' . $queryBuilder->expr()->notIn(
+                'pages.uid',
+                GeneralUtility::intExplode(',', $pidList)
+            );
         }
         // Setting GPvars:
         $parsedBody = $request->getParsedBody();
index 50ca222..8f7ab9c 100644 (file)
@@ -181,7 +181,7 @@ class NewMultiplePagesController
             $dataHandler = GeneralUtility::makeInstance(DataHandler::class);
             // Set default TCA values specific for the user
             $backendUser = $this->getBackendUser();
-            $tcaDefaultOverride = $backendUser->getTSConfigProp('TCAdefaults');
+            $tcaDefaultOverride = $backendUser->getTSConfig()['TCAdefaults.'] ?? null;
             if (is_array($tcaDefaultOverride)) {
                 $dataHandler->setDefaultsFromUserTS($tcaDefaultOverride);
             }
index 397c14c..6b0762c 100644 (file)
@@ -106,7 +106,7 @@ class TreeController
     public function __construct()
     {
         $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
-        $this->useNavTitle = (bool)$this->getBackendUser()->getTSConfigVal('options.pageTree.showNavTitle');
+        $this->useNavTitle = (bool)($this->getBackendUser()->getTSConfig()['options.']['pageTree.']['showNavTitle'] ?? false);
     }
 
     /**
@@ -136,6 +136,7 @@ class TreeController
      */
     protected function getDokTypes(): array
     {
+        $backendUser = $this->getBackendUser();
         $doktypeLabelMap = [];
         foreach ($GLOBALS['TCA']['pages']['columns']['doktype']['config']['items'] as $doktypeItemConfig) {
             if ($doktypeItemConfig[1] === '--div--') {
@@ -143,10 +144,10 @@ class TreeController
             }
             $doktypeLabelMap[$doktypeItemConfig[1]] = $doktypeItemConfig[0];
         }
-        $doktypes = GeneralUtility::intExplode(',', $this->getBackendUser()->getTSConfigVal('options.pageTree.doktypesToShowInNewPageDragArea'), true);
+        $doktypes = GeneralUtility::intExplode(',', $backendUser->getTSConfig()['options.']['pageTree.']['doktypesToShowInNewPageDragArea'] ?? '', true);
         $output = [];
-        $allowedDoktypes = GeneralUtility::intExplode(',', $this->getBackendUser()->groupData['pagetypes_select'], true);
-        $isAdmin = $this->getBackendUser()->isAdmin();
+        $allowedDoktypes = GeneralUtility::intExplode(',', $backendUser->groupData['pagetypes_select'], true);
+        $isAdmin = $backendUser->isAdmin();
         // Early return if backend user may not create any doktype
         if (!$isAdmin && empty($allowedDoktypes)) {
             return $output;
@@ -174,11 +175,12 @@ class TreeController
      */
     public function fetchDataAction(ServerRequestInterface $request): ResponseInterface
     {
-        $this->hiddenRecords = GeneralUtility::intExplode(',', $this->getBackendUser()->getTSConfigVal('options.hideRecords.pages'), true);
-        $this->backgroundColors = $this->getBackendUser()->getTSConfigProp('options.pageTree.backgroundColor');
-        $this->addIdAsPrefix = (bool)$this->getBackendUser()->getTSConfigVal('options.pageTree.showPageIdWithTitle');
-        $this->addDomainName = (bool)$this->getBackendUser()->getTSConfigVal('options.pageTree.showDomainNameWithTitle');
-        $this->showMountPathAboveMounts = (bool)$this->getBackendUser()->getTSConfigVal('options.pageTree.showPathAboveMounts');
+        $userTsConfig = $this->getBackendUser()->getTSConfig();
+        $this->hiddenRecords = GeneralUtility::intExplode(',', $userTsConfig['options.']['hideRecords.']['pages'] ?? '', true);
+        $this->backgroundColors = $userTsConfig['options.']['pageTree.']['backgroundColor.'] ?? [];
+        $this->addIdAsPrefix = (bool)($userTsConfig['options.']['pageTree.']['showPageIdWithTitle'] ?? false);
+        $this->addDomainName = (bool)($userTsConfig['options.']['pageTree.']['showDomainNameWithTitle'] ?? false);
+        $this->showMountPathAboveMounts = (bool)($userTsConfig['options.']['pageTree.']['showPathAboveMounts'] ?? false);
         $backendUserConfiguration = GeneralUtility::makeInstance(BackendUserConfiguration::class);
         $this->expandedState = $backendUserConfiguration->get('BackendComponents.States.Pagetree');
         if (is_object($this->expandedState->stateHash)) {
index 535ee4f..68a18eb 100644 (file)
@@ -228,7 +228,7 @@ class SimpleDataHandlerController
         if ($beUser->uc['neverHideAtCopy']) {
             $this->tce->neverHideAtCopy = 1;
         }
-        $TCAdefaultOverride = $beUser->getTSConfigProp('TCAdefaults');
+        $TCAdefaultOverride = $beUser->getTSConfig()['TCAdefaults.'] ?? null;
         if (is_array($TCAdefaultOverride)) {
             $this->tce->setDefaultsFromUserTS($TCAdefaultOverride);
         }
index 6c87305..95f6204 100644 (file)
@@ -15,8 +15,11 @@ namespace TYPO3\CMS\Backend\Domain\Repository\Module;
  */
 
 use TYPO3\CMS\Backend\Module\ModuleLoader;
+use TYPO3\CMS\Backend\Routing\UriBuilder;
+use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Imaging\IconFactory;
 use TYPO3\CMS\Core\Imaging\IconRegistry;
+use TYPO3\CMS\Core\Localization\LanguageService;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
@@ -212,16 +215,6 @@ class BackendModuleRepository implements \TYPO3\CMS\Core\SingletonInterface
     }
 
     /**
-     * Return language service instance
-     *
-     * @return \TYPO3\CMS\Core\Localization\LanguageService
-     */
-    protected function getLanguageService()
-    {
-        return $GLOBALS['LANG'];
-    }
-
-    /**
      * loads the module menu from the moduleloader based on $GLOBALS['TBE_MODULES']
      * and compiles an array with all the data needed for menu etc.
      *
@@ -240,8 +233,7 @@ class BackendModuleRepository implements \TYPO3\CMS\Core\SingletonInterface
 
         // Unset modules that are meant to be hidden from the menu.
         $loadedModules = $this->removeHiddenModules($loadedModules);
-        /** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
-        $uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
+        $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
         $dummyScript = (string)$uriBuilder->buildUriFromRoute('dummy');
         foreach ($loadedModules as $moduleName => $moduleData) {
             $moduleLink = '';
@@ -317,22 +309,21 @@ class BackendModuleRepository implements \TYPO3\CMS\Core\SingletonInterface
      */
     protected function removeHiddenModules($loadedModules)
     {
-        $hiddenModules = $GLOBALS['BE_USER']->getTSConfig('options.hideModules');
+        $userTsConfig = $this->getBackendUser()->getTSConfig();
 
         // Hide modules if set in userTS.
-        if (!empty($hiddenModules['value'])) {
-            $hiddenMainModules = explode(',', $hiddenModules['value']);
-            foreach ($hiddenMainModules as $hiddenMainModule) {
-                unset($loadedModules[trim($hiddenMainModule)]);
-            }
+        $hiddenMainModules = GeneralUtility::trimExplode(',', $userTsConfig['options.']['hideModules'] ?? '', true);
+        foreach ($hiddenMainModules as $hiddenMainModule) {
+            unset($loadedModules[$hiddenMainModule]);
         }
 
         // Hide sub-modules if set in userTS.
-        if (!empty($hiddenModules['properties']) && is_array($hiddenModules['properties'])) {
-            foreach ($hiddenModules['properties'] as $mainModuleName => $subModules) {
-                $hiddenSubModules = explode(',', $subModules);
+        $hiddenModules = $userTsConfig['options.']['hideModules.'] ?? [];
+        if (is_array($hiddenModules)) {
+            foreach ($hiddenModules as $mainModuleName => $subModules) {
+                $hiddenSubModules = GeneralUtility::trimExplode(',', $subModules, true);
                 foreach ($hiddenSubModules as $hiddenSubModule) {
-                    unset($loadedModules[$mainModuleName]['sub'][trim($hiddenSubModule)]);
+                    unset($loadedModules[$mainModuleName]['sub'][$hiddenSubModule]);
                 }
             }
         }
@@ -359,4 +350,22 @@ class BackendModuleRepository implements \TYPO3\CMS\Core\SingletonInterface
         }
         return '';
     }
+
+    /**
+     * Return language service instance
+     *
+     * @return LanguageService
+     */
+    protected function getLanguageService()
+    {
+        return $GLOBALS['LANG'];
+    }
+
+    /**
+     * @return BackendUserAuthentication
+     */
+    protected function getBackendUser(): BackendUserAuthentication
+    {
+        return $GLOBALS['BE_USER'];
+    }
 }
index ad9031c..dbb2471 100644 (file)
@@ -218,18 +218,18 @@ class FormResultCompiler
             }
         }
         $pageRenderer->loadJquery();
-        $beUserAuth = $this->getBackendUserAuthentication();
+        $backendUser = $this->getBackendUserAuthentication();
 
         // define the window size of the element browser etc.
         $popupWindowWidth  = 800;
         $popupWindowHeight = 600;
-        $popupWindowSize = trim($beUserAuth->getTSConfigVal('options.popupWindowSize'));
+        $popupWindowSize = trim($backendUser->getTSConfig()['options.']['popupWindowSize'] ?? '');
         if (!empty($popupWindowSize)) {
             list($popupWindowWidth, $popupWindowHeight) = GeneralUtility::intExplode('x', $popupWindowSize);
         }
 
         // define the window size of the popups within the RTE
-        $rtePopupWindowSize = trim($beUserAuth->getTSConfigVal('options.rte.popupWindowSize'));
+        $rtePopupWindowSize = trim($backendUser->getTSConfig()['options.']['rte.']['popupWindowSize'] ?? '');
         if (!empty($rtePopupWindowSize)) {
             list($rtePopupWindowWidth, $rtePopupWindowHeight) = GeneralUtility::trimExplode('x', $rtePopupWindowSize);
         }
@@ -238,7 +238,7 @@ class FormResultCompiler
 
         // Make textareas resizable and flexible ("autogrow" in height)
         $textareaSettings = [
-            'autosize'  => (bool)$beUserAuth->uc['resizeTextareas_Flexible'],
+            'autosize'  => (bool)$backendUser->uc['resizeTextareas_Flexible'],
             'RTEPopupWindow' => [
                 'width' => $rtePopupWindowWidth,
                 'height' => $rtePopupWindowHeight
index 5ff1f4f..4a1b18d 100644 (file)
@@ -1070,7 +1070,9 @@ abstract class AbstractTreeView
         foreach ($rootline as $rootlineElement) {
             $record = BackendUtility::getRecordWSOL('pages', $rootlineElement['uid'], 'title, nav_title', '', true, true);
             $text = $record['title'];
-            if ((bool)$this->getBackendUser()->getTSConfigVal('options.pageTree.showNavTitle') && trim($record['nav_title'] ?? '') !== '') {
+            if ((bool)($this->getBackendUser()->getTSConfig()['options.']['pageTree.']['showNavTitle'] ?? false)
+                && trim($record['nav_title'] ?? '') !== ''
+            ) {
                 $text = $record['nav_title'];
             }
             $path[] = htmlspecialchars($text);
index b1f775d..27b843a 100644 (file)
@@ -81,17 +81,19 @@ class BrowseTreeView extends AbstractTreeView
      */
     public function init($clause = '', $orderByFields = '')
     {
+        $backendUser = $this->getBackendUser();
         // This will hide records from display - it has nothing to do with user rights!!
         $clauseExcludePidList = '';
-        if ($pidList = $this->getBackendUser()->getTSConfigVal('options.hideRecords.pages')) {
+        $pidList = $backendUser->getTSConfig()['options.']['hideRecords.']['pages'] ?? '';
+        if (!empty($pidList)) {
             if ($pidList = implode(',', GeneralUtility::intExplode(',', $pidList))) {
                 $clauseExcludePidList = ' AND pages.uid NOT IN (' . $pidList . ')';
             }
         }
         // This is very important for making trees of pages: Filtering out deleted pages, pages with no access to and sorting them correctly:
-        parent::init(' AND deleted=0 AND sys_language_uid=0 AND ' . $this->getBackendUser()->getPagePermsClause(Permission::PAGE_SHOW) . ' ' . $clause . $clauseExcludePidList, 'sorting');
+        parent::init(' AND deleted=0 AND sys_language_uid=0 AND ' . $backendUser->getPagePermsClause(Permission::PAGE_SHOW) . ' ' . $clause . $clauseExcludePidList, 'sorting');
         $this->title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
-        $this->MOUNTS = $this->getBackendUser()->returnWebmounts();
+        $this->MOUNTS = $backendUser->returnWebmounts();
         if ($pidList) {
             // Remove mountpoint if explicitly set in options.hideRecords.pages (see above)
             $hideList = explode(',', $pidList);
@@ -148,7 +150,9 @@ class BrowseTreeView extends AbstractTreeView
         } else {
             $title = parent::getTitleStr($row, $titleLen);
         }
-        if (!empty($row['is_siteroot']) && $this->getBackendUser()->getTSConfigVal('options.pageTree.showDomainNameWithTitle')) {
+        if (!empty($row['is_siteroot'])
+            && $this->getBackendUser()->getTSConfig()['options.']['pageTree.']['showDomainNameWithTitle'] ?? false
+        ) {
             $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_domain');
             $row = $queryBuilder
                 ->select('domainName', 'sorting')
index 770c220..2c74eee 100644 (file)
@@ -2687,9 +2687,9 @@ class BackendUtility
     {
         // Look if a fixed preview language should be added:
         $beUser = static::getBackendUserAuthentication();
-        $viewLanguageOrder = $beUser->getTSConfigVal('options.view.languageOrder');
+        $viewLanguageOrder = (string)($beUser->getTSConfig()['options.']['view.']['languageOrder'] ?? '');
 
-        if ((string)$viewLanguageOrder !== '') {
+        if (!empty($viewLanguageOrder)) {
             $suffix = '';
             // Find allowed languages (if none, all are allowed!)
             $allowedLanguages = null;
@@ -2747,15 +2747,12 @@ class BackendUtility
         if (!empty($rootLine)) {
             $urlParts = parse_url($domain);
             $protocol = GeneralUtility::getIndpEnv('TYPO3_SSL') ? 'https' : 'http';
-            $previewDomainConfig = static::getBackendUserAuthentication()->getTSConfig(
-                'TCEMAIN.previewDomain',
-                self::getPagesTSconfig($pageId)
-            );
-            if ($previewDomainConfig['value']) {
-                if (strpos($previewDomainConfig['value'], '://') !== false) {
-                    list($protocol, $domainName) = explode('://', $previewDomainConfig['value']);
+            $previewDomainConfig = self::getPagesTSconfig($pageId)['TCEMAIN.']['previewDomain'] ?? '';
+            if (!empty($previewDomainConfig)) {
+                if (strpos($previewDomainConfig, '://') !== false) {
+                    list($protocol, $domainName) = explode('://', $previewDomainConfig);
                 } else {
-                    $domainName = $previewDomainConfig['value'];
+                    $domainName = $previewDomainConfig;
                 }
             } else {
                 $domainName = self::firstDomainRecord($rootLine);
index 3aa3996..ecdb09f 100644 (file)
@@ -1955,9 +1955,10 @@ class PageLayoutView implements LoggerAwareInterface
      */
     public function tt_content_drawHeader($row, $space = 0, $disableMoveAndNewButtons = false, $langMode = false, $dragDropEnabled = false)
     {
+        $backendUser = $this->getBackendUser();
         $out = '';
         // If show info is set...;
-        if ($this->tt_contentConfig['showInfo'] && $this->getBackendUser()->recordEditAccessInternals('tt_content', $row)) {
+        if ($this->tt_contentConfig['showInfo'] && $backendUser->recordEditAccessInternals('tt_content', $row)) {
             // Render control panel for the element:
             if ($this->tt_contentConfig['showCommands'] && $this->doEdit) {
                 // Edit content element:
@@ -1981,7 +1982,7 @@ class PageLayoutView implements LoggerAwareInterface
                 $hiddenField = $GLOBALS['TCA']['tt_content']['ctrl']['enablecolumns']['disabled'];
                 if ($hiddenField && $GLOBALS['TCA']['tt_content']['columns'][$hiddenField]
                     && (!$GLOBALS['TCA']['tt_content']['columns'][$hiddenField]['exclude']
-                        || $this->getBackendUser()->check('non_exclude_fields', 'tt_content:' . $hiddenField))
+                        || $backendUser->check('non_exclude_fields', 'tt_content:' . $hiddenField))
                 ) {
                     if ($row[$hiddenField]) {
                         $value = 0;
@@ -1997,8 +1998,11 @@ class PageLayoutView implements LoggerAwareInterface
                         . $this->iconFactory->getIcon('actions-edit-' . strtolower($label), Icon::SIZE_SMALL)->render() . '</a>';
                 }
                 // Delete
-                $disableDeleteTS = $this->getBackendUser()->getTSConfig('options.disableDelete');
-                $disableDelete = (bool)trim($disableDeleteTS['properties']['tt_content'] ?? $disableDeleteTS['value']);
+                $disableDelete = (bool)\trim(
+                    $backendUser->getTSConfig()['options.']['disableDelete.']['tt_content']
+                    ?? $backendUser->getTSConfig()['options.']['disableDelete']
+                    ?? '0'
+                );
                 if (!$disableDelete) {
                     $params = '&cmd[tt_content][' . $row['uid'] . '][delete]=1';
                     $refCountMsg = BackendUtility::referenceCount(
@@ -2020,7 +2024,7 @@ class PageLayoutView implements LoggerAwareInterface
                         . ' data-button-close-text="' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:cancel')) . '"'
                         . ' title="' . htmlspecialchars($this->getLanguageService()->getLL('deleteItem')) . '">'
                         . $this->iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render() . '</a>';
-                    if ($out && $this->getBackendUser()->doesUserHaveAccess($this->pageinfo, Permission::CONTENT_EDIT)) {
+                    if ($out && $backendUser->doesUserHaveAccess($this->pageinfo, Permission::CONTENT_EDIT)) {
                         $out = '<div class="btn-group btn-group-sm" role="group">' . $out . '</div>';
                     } else {
                         $out = '';
@@ -3093,11 +3097,9 @@ class PageLayoutView implements LoggerAwareInterface
             ->expr();
         $permsClause = $expressionBuilder->andX($backendUser->getPagePermsClause(Permission::PAGE_SHOW));
         // This will hide records from display - it has nothing to do with user rights!!
-        if ($pidList = $backendUser->getTSConfigVal('options.hideRecords.pages')) {
-            $pidList = GeneralUtility::intExplode(',', $pidList, true);
-            if (!empty($pidList)) {
-                $permsClause->add($expressionBuilder->notIn('pages.uid', $pidList));
-            }
+        $pidList = GeneralUtility::intExplode(',', $backendUser->getTSConfig()['options.']['hideRecords.']['pages'] ?? '', true);
+        if (!empty($pidList)) {
+            $permsClause->add($expressionBuilder->notIn('pages.uid', $pidList));
         }
         $this->perms_clause = (string)$permsClause;
 
index 06d42d8..0dc16ad 100644 (file)
@@ -168,7 +168,13 @@ class LoginControllerTest extends UnitTestCase
     {
         $GLOBALS['LANG'] = ($this->prophesize(LanguageService::class))->reveal();
         $authenticationProphecy = $this->prophesize(BackendUserAuthentication::class);
-        $authenticationProphecy->getTSConfigVal('auth.BE.redirectToURL')->willReturn('http://example.com');
+        $authenticationProphecy->getTSConfig()->willReturn([
+            'auth.' => [
+                'BE.' => [
+                    'redirectToURL' => 'http://example.com'
+                ]
+            ]
+        ]);
         $authenticationProphecy->writeUC()->willReturn();
         $authenticationProphecy->getSessionData('formProtectionSessionToken')->willReturn('foo');
         $GLOBALS['BE_USER'] = $authenticationProphecy->reveal();
@@ -197,7 +203,13 @@ class LoginControllerTest extends UnitTestCase
     {
         $GLOBALS['LANG'] = $this->prophesize(LanguageService::class)->reveal();
         $authenticationProphecy = $this->prophesize(BackendUserAuthentication::class);
-        $authenticationProphecy->getTSConfigVal('auth.BE.redirectToURL')->willReturn('http://example.com');
+        $authenticationProphecy->getTSConfig()->willReturn([
+            'auth.' => [
+                'BE.' => [
+                    'redirectToURL' => 'http://example.com'
+                ]
+            ]
+        ]);
         $authenticationProphecy->writeUC()->willReturn();
         $this->prophesizeFormProtection();
         $GLOBALS['BE_USER'] = $authenticationProphecy->reveal();
@@ -228,7 +240,13 @@ class LoginControllerTest extends UnitTestCase
     {
         $GLOBALS['LANG'] = $this->prophesize(LanguageService::class)->reveal();
         $authenticationProphecy = $this->prophesize(BackendUserAuthentication::class);
-        $authenticationProphecy->getTSConfigVal('auth.BE.redirectToURL')->willReturn('http://example.com');
+        $authenticationProphecy->getTSConfig()->willReturn([
+            'auth.' => [
+                'BE.' => [
+                    'redirectToURL' => 'http://example.com'
+                ]
+            ]
+        ]);
         $authenticationProphecy->writeUC()->willReturn();
         $GLOBALS['BE_USER'] = $authenticationProphecy->reveal();
         $this->prophesizeFormProtection();
index 112e5d5..9724263 100644 (file)
@@ -929,8 +929,8 @@ class BackendUserAuthentication extends AbstractUserAuthentication
      */
     public function mayMakeShortcut()
     {
-        return $this->getTSConfigVal('options.enableBookmarks')
-            && !$this->getTSConfigVal('options.mayNotCreateEditBookmarks');
+        return $this->getTSConfig()['options.']['enableBookmarks'] ?? false
+            && !($this->getTSConfig()['options.']['mayNotCreateEditBookmarks'] ?? false);
     }
 
     /**
@@ -1242,9 +1242,11 @@ class BackendUserAuthentication extends AbstractUserAuthentication
      * @param string $objectString Object string, eg. "somestring.someproperty.somesubproperty
      * @return string The value for that object string (object path)
      * @see getTSConfig()
+     * @deprecated since core v9, will be removed with core v10
      */
     public function getTSConfigVal($objectString)
     {
+        trigger_error('This getTSConfigVal() will be removed in TYPO3 v10. Use getTSConfig() instead.', E_USER_DEPRECATED);
         $TSConf = $this->getTSConfig($objectString);
         return $TSConf['value'];
     }
@@ -1255,9 +1257,11 @@ class BackendUserAuthentication extends AbstractUserAuthentication
      * @param string $objectString Object string, eg. "somestring.someproperty.somesubproperty
      * @return array The properties for that object string (object path) - if any
      * @see getTSConfig()
+     * @deprecated since core v9, will be removed with core v10
      */
     public function getTSConfigProp($objectString)
     {
+        trigger_error('This getTSConfigProp() will be removed in TYPO3 v10. Use getTSConfig() instead.', E_USER_DEPRECATED);
         $TSConf = $this->getTSConfig($objectString);
         return $TSConf['properties'];
     }
@@ -1304,7 +1308,7 @@ class BackendUserAuthentication extends AbstractUserAuthentication
     public function jsConfirmation($bitmask)
     {
         try {
-            $alertPopupsSetting = trim((string)$this->getTSConfig('options.alertPopups')['value']);
+            $alertPopupsSetting = trim((string)($this->getTSConfig()['options.']['alertPopups'] ?? ''));
             $alertPopup = JsConfirmation::cast($alertPopupsSetting === '' ? null : (int)$alertPopupsSetting);
         } catch (InvalidEnumerationValueException $e) {
             $alertPopup = new JsConfirmation();
@@ -1401,7 +1405,7 @@ class BackendUserAuthentication extends AbstractUserAuthentication
             }
             // Processing webmounts
             // Admin's always have the root mounted
-            if ($this->isAdmin() && !$this->getTSConfigVal('options.dontMountAdminMounts')) {
+            if ($this->isAdmin() && !($this->getTSConfig()['options.']['dontMountAdminMounts'] ?? false)) {
                 $this->dataLists['webmount_list'] = '0,' . $this->dataLists['webmount_list'];
             }
             // The lists are cleaned for duplicates
@@ -1696,7 +1700,7 @@ class BackendUserAuthentication extends AbstractUserAuthentication
         }
 
         // Read-only file mounts
-        $readOnlyMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.altElementBrowserMountPoints'));
+        $readOnlyMountPoints = \trim($this->getTSConfig()['options.']['folderTree.']['altElementBrowserMountPoints'] ?? '');
         if ($readOnlyMountPoints) {
             // We cannot use the API here but need to fetch the default storage record directly
             // to not instantiate it (which directly applies mount points) before all mount points are resolved!
@@ -1948,7 +1952,7 @@ class BackendUserAuthentication extends AbstractUserAuthentication
      */
     public function getDefaultUploadFolder($pid = null, $table = null, $field = null)
     {
-        $uploadFolder = $this->getTSConfigVal('options.defaultUploadFolder');
+        $uploadFolder = $this->getTSConfig()['options.']['defaultUploadFolder'] ?? '';
         if ($uploadFolder) {
             $uploadFolder = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getFolderObjectFromCombinedIdentifier($uploadFolder);
         } else {
@@ -2062,9 +2066,9 @@ class BackendUserAuthentication extends AbstractUserAuthentication
         $this->setWorkspace($this->user['workspace_id']);
         // Limiting the DB mountpoints if there any selected in the workspace record
         $this->initializeDbMountpointsInWorkspace();
-        if ($allowed_languages = $this->getTSConfigVal('options.workspaces.allowed_languages.' . $this->workspace)) {
-            $this->groupData['allowed_languages'] = $allowed_languages;
-            $this->groupData['allowed_languages'] = GeneralUtility::uniqueList($this->groupData['allowed_languages']);
+        $allowed_languages = $this->getTSConfig()['options.']['workspaces.']['allowed_languages.'][$this->workspace] ?? '';
+        if (!empty($allowed_languages)) {
+            $this->groupData['allowed_languages'] = GeneralUtility::uniqueList($allowed_languages);
         }
     }
 
@@ -2486,8 +2490,8 @@ This is a dump of the failures:
     {
         $isValid = true;
         if ($GLOBALS['TYPO3_CONF_VARS']['BE']['enabledBeUserIPLock']) {
-            $IPList = $this->getTSConfigVal('options.lockToIP');
-            if (trim($IPList)) {
+            $IPList = trim($this->getTSConfig()['options.']['lockToIP'] ?? '');
+            if (!empty($IPList)) {
                 $isValid = GeneralUtility::cmpIP(GeneralUtility::getIndpEnv('REMOTE_ADDR'), $IPList);
             }
         }
@@ -2560,7 +2564,7 @@ This is a dump of the failures:
             $this->uc = array_merge(
                 $this->uc_default,
                 (array)$GLOBALS['TYPO3_CONF_VARS']['BE']['defaultUC'],
-                GeneralUtility::removeDotsFromTS((array)$this->getTSConfigProp('setup.default')),
+                GeneralUtility::removeDotsFromTS((array)($this->getTSConfig()['setup.']['default.'] ?? [])),
                 $originalUc
             );
             $this->overrideUC();
@@ -2595,7 +2599,7 @@ This is a dump of the failures:
      */
     public function overrideUC()
     {
-        $this->uc = array_merge((array)$this->uc, (array)$this->getTSConfigProp('setup.override'));
+        $this->uc = array_merge((array)$this->uc, (array)($this->getTSConfig()['setup.']['override.'] ?? []));
     }
 
     /**
index 41111ac..49c72db 100644 (file)
@@ -8582,9 +8582,10 @@ class DataHandler implements LoggerAwareInterface
         if (is_object($this->BE_USER)) {
             $this->BE_USER->writelog(3, 1, 0, 0, 'User %s has cleared the cache (cacheCmd=%s)', [$this->BE_USER->user['username'], $cacheCmd]);
         }
+        $userTsConfig = $this->BE_USER->getTSConfig();
         switch (strtolower($cacheCmd)) {
             case 'pages':
-                if ($this->admin || $this->BE_USER->getTSConfigVal('options.clearCache.pages')) {
+                if ($this->admin || $userTsConfig['options.']['clearCache.']['pages'] ?? false) {
                     $this->getCacheManager()->flushCachesInGroup('pages');
                 }
                 break;
@@ -8592,7 +8593,9 @@ class DataHandler implements LoggerAwareInterface
                 // allow to clear all caches if the TS config option is enabled or the option is not explicitly
                 // disabled for admins (which could clear all caches by default). The latter option is useful
                 // for big production sites where it should be possible to restrict the cache clearing for some admins.
-                if ($this->BE_USER->getTSConfigVal('options.clearCache.all') || ($this->admin && $this->BE_USER->getTSConfigVal('options.clearCache.all') !== '0')) {
+                if ($userTsConfig['options.']['clearCache.']['all'] ?? false
+                    || ($this->admin && (bool)($userTsConfig['options.']['clearCache.']['all'] ?? true))
+                ) {
                     $this->getCacheManager()->flushCaches();
                     GeneralUtility::makeInstance(ConnectionPool::class)
                         ->getConnectionForTable('cache_treelist')
@@ -8610,7 +8613,7 @@ class DataHandler implements LoggerAwareInterface
                     . ' instead or call the group cache clearing of "system" group directly via a custom extension.',
                     E_USER_DEPRECATED
                 );
-                if ($this->admin || $this->BE_USER->getTSConfigVal('options.clearCache.system')) {
+                if ($this->admin || $userTsConfig['options.']['clearCache.']['system'] ?? false) {
                     $this->getCacheManager()->flushCachesInGroup('system');
                 }
                 break;
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-84993-DeprecateSomeTSconfigRelatedMethods.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-84993-DeprecateSomeTSconfigRelatedMethods.rst
new file mode 100644 (file)
index 0000000..6a881f3
--- /dev/null
@@ -0,0 +1,74 @@
+.. include:: ../../Includes.txt
+
+=============================================================
+Deprecation: #84993 - Deprecate some TSconfig related methods
+=============================================================
+
+See :issue:`84993`
+
+Description
+===========
+
+Some user TSconfig related methods have been deprecated:
+
+* :php:`TYPO3\CMS\core\Authentication\BackendUserAuthentication->getTSConfigVal()`
+* :php:`TYPO3\CMS\core\Authentication\BackendUserAuthentication->getTSConfigProp()`
+
+
+Impact
+======
+
+Calling the above methods logs a deprecation message.
+
+
+Affected Installations
+======================
+
+Extensions with backend modules may call these methods. The extension scanner
+will find affected code occurrences in extensions.
+
+
+Migration
+=========
+
+Change the calls to use :php:`BackendUserAuthentication->getTSConfig()` instead, it
+comes with a slightly changed return syntax.
+
+:php:`getTSConfig()` without arguments simply returns the entire user TSconfig as array, similar to other
+methods that return parsed TypoScript arrays. The examples below show some imaginary user TSConfig TypoScript,
+the full parsed array returned by :php:`getTSConfig()` and some typical access patterns with fallback. Note
+it's almost always useful to use the null coalescence :php:`??` operator for a fallback value to suppress
+PHP notice level warnings::
+
+    // Incoming user TSconfig:
+    // options.someToggle = 1
+    // options.somePartWithSubToggles = foo
+    // options.somePartWithSubToggles.aValue = bar
+
+    // Parsed array returned by getTSConfig(), note the dot if a property has sub keys:
+    // [
+    //     'options.' => [
+    //         'someToggle' => '1',
+    //         'somePartWithSubToggles' => 'foo',
+    //         'somePartWithSubToggles.' => [
+    //             'aValue' => 'bar',
+    //         ],
+    //     ],
+    // ],
+    $userTsConfig = $backendUserAuthentication->getTSConfig():
+
+    // Typical call to retrieve a sanitized value:
+    $isToggleEnabled = (bool)($userTsConfig['options.']['someToggle'] ?? false);
+
+    // And to retrieve a sub set, note the dot at the end:
+    $subArray = $userTsConfig['options.']['somePartWithSubToggles.'] ?? [];
+
+    // Switch an old getTSConfigVal() to getTSConfig(), note the parenthesis:
+    $value = (bool)$backendUser->getTSConfigVal('options.someToggle');
+    $value = (bool)($backendUser->getTSConfig()['options.']['someToggle] ?? false);
+
+    // Switch an old getTSConfigProp() to getTSConfig(), note the parenthesis and the trailing dot:
+    $value = (array)$backendUser->getTSConfigProp('options.somePartWithSubToggles');
+    $value = (array)($backendUser->getTSConfig()['options.']['somePartWithSubToggles.'] ?? []);
+
+.. index:: Backend, PHP-API, TSConfig, FullyScanned
\ No newline at end of file
index 7dc762f..6fc2e51 100644 (file)
@@ -723,8 +723,11 @@ class BackendUserAuthenticationTest extends UnitTestCase
         $subject = $this->getMockBuilder(BackendUserAuthentication::class)
             ->setMethods(['getTSConfig'])
             ->getMock();
-        $subject->method('getTSConfig')->with('options.alertPopups')->willReturn(['value' => 1]);
-
+        $subject->method('getTSConfig')->with()->willReturn([
+            'options.' => [
+                'alertPopups' => 1
+            ],
+        ]);
         $this->assertTrue($subject->jsConfirmation(JsConfirmation::TYPE_CHANGE));
         $this->assertFalse($subject->jsConfirmation(JsConfirmation::COPY_MOVE_PASTE));
     }
@@ -738,8 +741,11 @@ class BackendUserAuthenticationTest extends UnitTestCase
         $subject = $this->getMockBuilder(BackendUserAuthentication::class)
             ->setMethods(['getTSConfig'])
             ->getMock();
-        $subject->method('getTSConfig')->with('options.alertPopups')->willReturn(['value' => 3]);
-
+        $subject->method('getTSConfig')->with()->willReturn([
+            'options.' => [
+                'alertPopups' => 3
+            ],
+        ]);
         $this->assertTrue($subject->jsConfirmation(JsConfirmation::TYPE_CHANGE));
         $this->assertTrue($subject->jsConfirmation(JsConfirmation::COPY_MOVE_PASTE));
     }
@@ -760,8 +766,11 @@ class BackendUserAuthenticationTest extends UnitTestCase
         $subject = $this->getMockBuilder(BackendUserAuthentication::class)
             ->setMethods(['getTSConfig'])
             ->getMock();
-        $subject->method('getTSConfig')->with('options.alertPopups')->willReturn(['value' => $jsConfirmation]);
-
+        $subject->method('getTSConfig')->with()->willReturn([
+            'options.' => [
+                'alertPopups' => $jsConfirmation
+            ],
+        ]);
         $this->assertEquals($typeChangeAllowed, $subject->jsConfirmation(JsConfirmation::TYPE_CHANGE));
         $this->assertEquals($copyMovePasteAllowed, $subject->jsConfirmation(JsConfirmation::COPY_MOVE_PASTE));
         $this->assertEquals($deleteAllowed, $subject->jsConfirmation(JsConfirmation::DELETE));
@@ -803,8 +812,11 @@ class BackendUserAuthenticationTest extends UnitTestCase
         $subject = $this->getMockBuilder(BackendUserAuthentication::class)
             ->setMethods(['getTSConfig'])
             ->getMock();
-        $subject->method('getTSConfig')->with('options.alertPopups')->willReturn(['value' => 0]);
-
+        $subject->method('getTSConfig')->with()->willReturn([
+            'options.' => [
+                'alertPopups' => 0
+            ],
+        ]);
         $this->assertFalse($subject->jsConfirmation(JsConfirmation::TYPE_CHANGE));
         $this->assertFalse($subject->jsConfirmation(JsConfirmation::COPY_MOVE_PASTE));
     }
index 4f26d85..cd623ad 100644 (file)
@@ -143,13 +143,12 @@ class DocumentController extends ActionController
         $documents = $this->getDocuments();
 
         // Filter documents to be shown for current user
-        $hideDocuments = $this->getBackendUser()->getTSConfigVal('mod.help_DocumentationDocumentation.documents.hide');
-        $hideDocuments = GeneralUtility::trimExplode(',', $hideDocuments, true);
+        $userTsConfig = $this->getBackendUser()->getTSConfig();
+        $hideDocuments = GeneralUtility::trimExplode(',', $userTsConfig['mod.']['help_DocumentationDocumentation.']['documents.']['hide'] ?? '', true);
         if (!empty($hideDocuments)) {
             $documents = array_diff_key($documents, array_flip($hideDocuments));
         }
-        $showDocuments = $this->getBackendUser()->getTSConfigVal('mod.help_DocumentationDocumentation.documents.show');
-        $showDocuments = GeneralUtility::trimExplode(',', $showDocuments, true);
+        $showDocuments = GeneralUtility::trimExplode(',', $userTsConfig['mod.']['help_DocumentationDocumentation.']['documents.']['show'] ?? '', true);
         if (!empty($showDocuments)) {
             $documents = array_intersect_key($documents, array_flip($showDocuments));
         }
index 0133177..1aea7fa 100644 (file)
@@ -296,8 +296,8 @@ class FrontendEditPanel
      */
     protected function editPanelLinkWrap_doWrap($string, $url, $additionalClasses = '')
     {
-        $width = MathUtility::forceIntegerInRange($this->backendUser->getTSConfigVal('options.feedit.popupWidth'), 690, 5000, 690);
-        $height = MathUtility::forceIntegerInRange($this->backendUser->getTSConfigVal('options.feedit.popupHeight'), 500, 5000, 500);
+        $width = MathUtility::forceIntegerInRange($this->backendUser->getTSConfig()['options.']['feedit.']['popupWidth'] ?? 690, 690, 5000, 690);
+        $height = MathUtility::forceIntegerInRange($this->backendUser->getTSConfig()['options.']['feedit.']['popupHeight'] ?? 500, 500, 5000, 500);
         $onclick = 'vHWin=window.open(' . GeneralUtility::quoteJSvalue($url . '&returnUrl=' . rawurlencode(PathUtility::getAbsoluteWebPath(GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Public/Html/Close.html')))) . ',\'FEquickEditWindow\',\'width=' . $width . ',height=' . $height . ',status=0,menubar=0,scrollbars=1,resizable=1\');vHWin.focus();return false;';
         return '<a href="#" class="typo3-editPanel-btn typo3-editPanel-btn-default frontEndEditIconLinks ' . htmlspecialchars($additionalClasses) . '" onclick="' . htmlspecialchars($onclick) . '" style="display: none;">' . $string . '</a>';
     }
index 29b8ade..d2f886b 100644 (file)
@@ -42,7 +42,7 @@ class FrontendEditInitiator implements MiddlewareInterface
     public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
     {
         if (isset($GLOBALS['BE_USER']) && $GLOBALS['BE_USER'] instanceof FrontendBackendUserAuthentication) {
-            $config = $GLOBALS['BE_USER']->getTSConfigProp('admPanel');
+            $config = $GLOBALS['BE_USER']->getTSConfig()['admPanel.'] ?? [];
             $active = (int)$GLOBALS['TSFE']->displayEditIcons === 1 || (int)$GLOBALS['TSFE']->displayFieldEditIcons === 1;
             if ($active && isset($config['enable.'])) {
                 foreach ($config['enable.'] as $value) {
index 67970f9..e95450c 100644 (file)
@@ -306,21 +306,22 @@ class FileListController extends ActionController
         // Apply predefined values for hidden checkboxes
         // Set predefined value for DisplayBigControlPanel:
         $backendUser = $this->getBackendUser();
-        if ($backendUser->getTSConfigVal('options.file_list.enableDisplayBigControlPanel') === 'activated') {
+        $userTsConfig = $backendUser->getTSConfig();
+        if ($userTsConfig['options.']['file_list.']['enableDisplayBigControlPanel'] ?? '' === 'activated') {
             $this->MOD_SETTINGS['bigControlPanel'] = true;
-        } elseif ($backendUser->getTSConfigVal('options.file_list.enableDisplayBigControlPanel') === 'deactivated') {
+        } elseif ($userTsConfig['options.']['file_list.']['enableDisplayBigControlPanel'] ?? '' === 'deactivated') {
             $this->MOD_SETTINGS['bigControlPanel'] = false;
         }
         // Set predefined value for DisplayThumbnails:
-        if ($backendUser->getTSConfigVal('options.file_list.enableDisplayThumbnails') === 'activated') {
+        if ($userTsConfig['options.']['file_list.']['enableDisplayThumbnails'] ?? '' === 'activated') {
             $this->MOD_SETTINGS['displayThumbs'] = true;
-        } elseif ($backendUser->getTSConfigVal('options.file_list.enableDisplayThumbnails') === 'deactivated') {
+        } elseif ($userTsConfig['options.']['file_list.']['enableDisplayThumbnails'] ?? '' === 'deactivated') {
             $this->MOD_SETTINGS['displayThumbs'] = false;
         }
         // Set predefined value for Clipboard:
-        if ($backendUser->getTSConfigVal('options.file_list.enableClipBoard') === 'activated') {
+        if ($userTsConfig['options.']['file_list.']['enableClipBoard'] ?? '' === 'activated') {
             $this->MOD_SETTINGS['clipBoard'] = true;
-        } elseif ($backendUser->getTSConfigVal('options.file_list.enableClipBoard') === 'deactivated') {
+        } elseif ($userTsConfig['options.']['file_list.']['enableClipBoard'] ?? '' === 'deactivated') {
             $this->MOD_SETTINGS['clipBoard'] = false;
         }
         // If user never opened the list module, set the value for displayThumbs
@@ -343,6 +344,7 @@ class FileListController extends ActionController
 
         // There there was access to this file path, continue, make the list
         if ($this->folderObject) {
+            $userTsConfig = $this->getBackendUser()->getTSConfig();
             // Create fileListing object
             $this->filelist = GeneralUtility::makeInstance(FileList::class, $this);
             $this->filelist->thumbs = $GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails'] && $this->MOD_SETTINGS['displayThumbs'];
@@ -433,7 +435,7 @@ class FileListController extends ActionController
 
             $this->view->assign('checkboxes', [
                 'bigControlPanel' => [
-                    'enabled' => $this->getBackendUser()->getTSConfigVal('options.file_list.enableDisplayBigControlPanel') === 'selectable',
+                    'enabled' => $userTsConfig['options.']['file_list.']['enableDisplayBigControlPanel'] ?? '' === 'selectable',
                     'label' => htmlspecialchars($this->getLanguageService()->getLL('bigControlPanel')),
                     'html' => BackendUtility::getFuncCheck(
                         $this->id,
@@ -445,7 +447,7 @@ class FileListController extends ActionController
                     ),
                 ],
                 'displayThumbs' => [
-                    'enabled' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails'] && $this->getBackendUser()->getTSConfigVal('options.file_list.enableDisplayThumbnails') === 'selectable',
+                    'enabled' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails'] && $userTsConfig['options.']['file_list.']['enableDisplayThumbnails'] ?? '' === 'selectable',
                     'label' => htmlspecialchars($this->getLanguageService()->getLL('displayThumbs')),
                     'html' => BackendUtility::getFuncCheck(
                         $this->id,
@@ -457,7 +459,7 @@ class FileListController extends ActionController
                     ),
                 ],
                 'enableClipBoard' => [
-                    'enabled' => $this->getBackendUser()->getTSConfigVal('options.file_list.enableClipBoard') === 'selectable',
+                    'enabled' => $userTsConfig['options.']['file_list.']['enableClipBoard'] ?? '' === 'selectable',
                     'label' => htmlspecialchars($this->getLanguageService()->getLL('clipBoard')),
                     'html' => BackendUtility::getFuncCheck(
                         $this->id,
index ea3e783..1c3d1df 100644 (file)
@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Form\Controller;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Backend\Routing\UriBuilder;
 use TYPO3\CMS\Backend\Template\Components\ButtonBar;
 use TYPO3\CMS\Backend\View\BackendTemplateView;
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
@@ -105,14 +106,11 @@ class FormEditorController extends AbstractBackendController
 
         $popupWindowWidth  = 700;
         $popupWindowHeight = 750;
-        $popupWindowSize = $this->getBackendUser()->getTSConfigVal('options.popupWindowSize')
-            ? trim($this->getBackendUser()->getTSConfigVal('options.popupWindowSize'))
-            : null;
+        $popupWindowSize = \trim($this->getBackendUser()->getTSConfig()['options.']['popupWindowSize'] ?? '');
         if (!empty($popupWindowSize)) {
             list($popupWindowWidth, $popupWindowHeight) = GeneralUtility::intExplode('x', $popupWindowSize);
         }
-        /** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
-        $uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
+        $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
         $addInlineSettings = [
             'FormEditor' => [
                 'typo3WinBrowserUrl' => (string)$uriBuilder->buildUriFromRoute('wizard_element_browser'),
@@ -321,8 +319,8 @@ class FormEditorController extends AbstractBackendController
                 ->setValue('new-page')
                 ->setClasses('t3-form-element-new-page-button hidden')
                 ->setIcon($this->view->getModuleTemplate()->getIconFactory()->getIcon('actions-page-new', Icon::SIZE_SMALL));
-            /** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
-            $uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
+            /** @var UriBuilder $uriBuilder */
+            $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
 
             $closeButton = $buttonBar->makeLinkButton()
                 ->setDataAttributes(['identifier' => 'closeButton'])
index e24a9f9..454ff7d 100644 (file)
@@ -117,12 +117,7 @@ class ItemProvider extends AbstractProvider
      */
     protected function isImportEnabled(): bool
     {
-        if (!$this->backendUser->isAdmin()) {
-            $isEnabledForNonAdmin = $this->backendUser->getTSConfig('options.impexp.enableImportForNonAdminUser');
-            if (empty($isEnabledForNonAdmin['value'])) {
-                return false;
-            }
-        }
-        return true;
+        return $this->backendUser->isAdmin()
+            || !$this->backendUser->isAdmin() && (bool)($this->backendUser->getTSConfig()['options.']['impexp.']['enableImportForNonAdminUser'] ?? false);
     }
 }
index 5eff184..423d213 100644 (file)
@@ -217,7 +217,6 @@ class ImportExportController extends BaseScriptClass
             // flag doesn't exist initially; state is on by default
             $inData['excludeDisabled'] = 1;
         }
-        /** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
         $uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
         $this->standaloneView->assign('moduleUrl', (string)$uriBuilder->buildUriFromRoute('xMOD_tximpexp'));
         $this->standaloneView->assign('id', $this->id);
@@ -232,8 +231,8 @@ class ImportExportController extends BaseScriptClass
                 break;
             case 'import':
                 $backendUser = $this->getBackendUser();
-                $isEnabledForNonAdmin = $backendUser->getTSConfig('options.impexp.enableImportForNonAdminUser');
-                if (!$backendUser->isAdmin() && empty($isEnabledForNonAdmin['value'])) {
+                $isEnabledForNonAdmin = (bool)($backendUser->getTSConfig()['options.']['impexp.']['enableImportForNonAdminUser'] ?? false);
+                if (!$backendUser->isAdmin() && $isEnabledForNonAdmin) {
                     throw new \RuntimeException(
                         'Import module is disabled for non admin users and '
                         . 'userTsConfig options.impexp.enableImportForNonAdminUser is not enabled.',
index 6e79738..4dfdc79 100644 (file)
@@ -2186,4 +2186,18 @@ return [
             'Deprecation-84981-BackendUserAuthentication-simplelogDeprecated.rst',
         ],
     ],
+    'TYPO3\CMS\Core\Authentication\BackendUserAuthentication->getTSConfigVal' => [
+        'numberOfMandatoryArguments' => 1,
+        'maximumNumberOfArguments' => 1,
+        'restFiles' => [
+            'Deprecation-84993-DeprecateSomeTSconfigRelatedMethods.rst',
+        ],
+    ],
+    'TYPO3\CMS\Core\Authentication\BackendUserAuthentication->getTSConfigProp' => [
+        'numberOfMandatoryArguments' => 1,
+        'maximumNumberOfArguments' => 1,
+        'restFiles' => [
+            'Deprecation-84993-DeprecateSomeTSconfigRelatedMethods.rst',
+        ],
+    ],
 ];
index 2db37a5..095cd33 100644 (file)
@@ -53,11 +53,9 @@ class OpendocsToolbarItem implements ToolbarItemInterface
      *
      * @return bool TRUE if user has access, FALSE if not
      */
-    public function checkAccess()
+    public function checkAccess(): bool
     {
-        $disabled = $this->getBackendUser()->getTSConfig('backendToolbarItem.tx_opendocs.disabled');
-
-        return (int)$disabled['value'] !== 1;
+        return !(bool)($this->getBackendUser()->getTSConfig()['backendToolbarItem.']['tx_opendocs.']['disabled'] ?? false);
     }
 
     /**
index 0248faa..af858a2 100644 (file)
@@ -76,19 +76,18 @@ class DatabaseBrowser extends AbstractElementBrowser implements ElementBrowserIn
      */
     public function render()
     {
-        $this->setTemporaryDbMounts();
+        $userTsConfig = $this->getBackendUser()->getTSConfig();
 
+        $this->setTemporaryDbMounts();
         list(, , , $allowedTables) = explode('|', $this->bparams);
-        $backendUser = $this->getBackendUser();
 
         // Making the browsable pagetree:
-        /** @var ElementBrowserPageTreeView $pageTree */
         $pageTree = GeneralUtility::makeInstance(ElementBrowserPageTreeView::class);
         $pageTree->setLinkParameterProvider($this);
         $pageTree->ext_pArrPages = $allowedTables === 'pages';
-        $pageTree->ext_showNavTitle = (bool)$backendUser->getTSConfigVal('options.pageTree.showNavTitle');
-        $pageTree->ext_showPageId = (bool)$backendUser->getTSConfigVal('options.pageTree.showPageIdWithTitle');
-        $pageTree->ext_showPathAboveMounts = (bool)$backendUser->getTSConfigVal('options.pageTree.showPathAboveMounts');
+        $pageTree->ext_showNavTitle = (bool)($userTsConfig['options.']['pageTree.']['showNavTitle'] ?? false);
+        $pageTree->ext_showPageId = (bool)($userTsConfig['options.']['pageTree.']['showPageIdWithTitle'] ?? false);
+        $pageTree->ext_showPathAboveMounts = (bool)($userTsConfig['options.']['pageTree.']['showPathAboveMounts'] ?? false);
         $pageTree->addField('nav_title');
         $tree = $pageTree->getBrowsableTree();
 
@@ -179,8 +178,8 @@ class DatabaseBrowser extends AbstractElementBrowser implements ElementBrowserIn
             $backendUser->setWebmounts($alternativeWebmountPoint);
         } else {
             // Setting alternative browsing mounts (ONLY local to browse_links.php this script so they stay "read-only")
-            $alternativeWebmountPoints = trim($backendUser->getTSConfigVal('options.pageTree.altElementBrowserMountPoints'));
-            $appendAlternativeWebmountPoints = $backendUser->getTSConfigVal('options.pageTree.altElementBrowserMountPoints.append');
+            $alternativeWebmountPoints = \trim($backendUser->getTSConfig()['options.']['pageTree.']['altElementBrowserMountPoints'] ?? '');
+            $appendAlternativeWebmountPoints = $backendUser->getTSConfig()['options.']['pageTree.']['altElementBrowserMountPoints.']['append'] ?? '';
             if ($alternativeWebmountPoints) {
                 $alternativeWebmountPoints = GeneralUtility::intExplode(',', $alternativeWebmountPoints);
                 $this->getBackendUser()->setWebmounts($alternativeWebmountPoints, $appendAlternativeWebmountPoints);
index 8e79746..68ccaf8 100644 (file)
@@ -182,7 +182,7 @@ class FileBrowser extends AbstractElementBrowser implements ElementBrowserInterf
         }
 
         // Getting flag for showing/not showing thumbnails:
-        $noThumbs = $backendUser->getTSConfigVal('options.noThumbsInEB');
+        $noThumbs = $backendUser->getTSConfig()['options.']['noThumbsInEB'] ?? false;
         $_MOD_SETTINGS = [];
         if (!$noThumbs) {
             // MENU-ITEMS, fetching the setting for thumbnails from File>List module:
@@ -412,7 +412,7 @@ class FileBrowser extends AbstractElementBrowser implements ElementBrowserInterf
         $out = '';
 
         // Getting flag for showing/not showing thumbnails:
-        $noThumbsInEB = $this->getBackendUser()->getTSConfigVal('options.noThumbsInEB');
+        $noThumbsInEB = $this->getBackendUser()->getTSConfig()['options.']['noThumbsInEB'] ?? false;
         if (!$noThumbsInEB && $this->selectedFolder) {
             // MENU-ITEMS, fetching the setting for thumbnails from File>List module:
             $_MOD_MENU = ['displayThumbs' => ''];
index 952edd2..e4dba74 100644 (file)
@@ -265,10 +265,7 @@ abstract class AbstractLinkBrowserController
      */
     protected function getLinkHandlers()
     {
-        $pageTSconfig = BackendUtility::getPagesTSconfig($this->getCurrentPageId());
-        $pageTSconfig = $this->getBackendUser()->getTSConfig('TCEMAIN.linkHandler.', $pageTSconfig);
-        $linkHandlers = (array)$pageTSconfig['properties'];
-
+        $linkHandlers = (array)(BackendUtility::getPagesTSconfig($this->getCurrentPageId())['TCEMAIN.']['linkHandler.'] ?? []);
         foreach ($this->hookObjects as $hookObject) {
             if (method_exists($hookObject, 'modifyLinkHandlers')) {
                 $linkHandlers = $hookObject->modifyLinkHandlers($linkHandlers, $this->currentLinkParts);
index 545b533..564c68f 100644 (file)
@@ -129,8 +129,8 @@ abstract class AbstractLinkHandler
             $backendUser->setWebmounts($alternativeWebmountPoint);
         } else {
             // Setting alternative browsing mounts (ONLY local to browse_links.php this script so they stay "read-only")
-            $alternativeWebmountPoints = trim($backendUser->getTSConfigVal('options.pageTree.altElementBrowserMountPoints'));
-            $appendAlternativeWebmountPoints = $backendUser->getTSConfigVal('options.pageTree.altElementBrowserMountPoints.append');
+            $alternativeWebmountPoints = \trim($backendUser->getTSConfig()['options.']['pageTree.']['altElementBrowserMountPoints'] ?? '');
+            $appendAlternativeWebmountPoints = $backendUser->getTSConfig()['options.']['pageTree.']['altElementBrowserMountPoints.']['append'] ?? '';
             if ($alternativeWebmountPoints) {
                 $alternativeWebmountPoints = GeneralUtility::intExplode(',', $alternativeWebmountPoints);
                 $this->getBackendUser()->setWebmounts($alternativeWebmountPoints, $appendAlternativeWebmountPoints);
index bd53f75..68cc329 100644 (file)
@@ -124,7 +124,7 @@ class FileLinkHandler extends AbstractLinkHandler implements LinkHandlerInterfac
             $createFolder = $folderUtilityRenderer->createFolder($selectedFolder);
 
             // Insert the upload form on top, if so configured
-            $positionOfUploadFieldsOnTop = $this->getBackendUser()->getTSConfigVal('options.uploadFieldsInTopOfEB');
+            $positionOfUploadFieldsOnTop = (bool)($this->getBackendUser()->getTSConfig()['options.']['uploadFieldsInTopOfEB'] ?? false);
             $this->view->assign('positionOfUploadFields', $positionOfUploadFieldsOnTop ? 'top' : 'bottom');
             $this->view->assign('uploadFileForm', $uploadForm);
             $this->view->assign('createFolderForm', $createFolder);
index 8749731..5ed20b5 100644 (file)
@@ -132,14 +132,13 @@ class PageLinkHandler extends AbstractLinkHandler implements LinkHandlerInterfac
         $this->expandPage = isset($request->getQueryParams()['expandPage']) ? (int)$request->getQueryParams()['expandPage'] : 0;
         $this->setTemporaryDbMounts();
 
-        $backendUser = $this->getBackendUser();
+        $userTsConfig = $this->getBackendUser()->getTSConfig();
 
-        /** @var ElementBrowserPageTreeView $pageTree */
         $pageTree = GeneralUtility::makeInstance(ElementBrowserPageTreeView::class);
         $pageTree->setLinkParameterProvider($this);
-        $pageTree->ext_showNavTitle = (bool)$backendUser->getTSConfigVal('options.pageTree.showNavTitle');
-        $pageTree->ext_showPageId = (bool)$backendUser->getTSConfigVal('options.pageTree.showPageIdWithTitle');
-        $pageTree->ext_showPathAboveMounts = (bool)$backendUser->getTSConfigVal('options.pageTree.showPathAboveMounts');
+        $pageTree->ext_showNavTitle = (bool)($userTsConfig['options.']['pageTree.']['showNavTitle'] ?? false);
+        $pageTree->ext_showPageId = (bool)($userTsConfig['options.']['pageTree.']['showPageIdWithTitle'] ?? false);
+        $pageTree->ext_showPathAboveMounts = (bool)($userTsConfig['options.']['pageTree.']['showPathAboveMounts'] ?? false);
         $pageTree->addField('nav_title');
 
         $this->view->assign('temporaryTreeMountCancelLink', $this->getTemporaryTreeMountCancelNotice());
index 7056bac..3e7807c 100644 (file)
@@ -165,14 +165,14 @@ class RecordLinkHandler extends AbstractLinkHandler implements LinkHandlerInterf
      */
     protected function renderPageTree(): string
     {
-        $backendUser = $this->getBackendUser();
+        $userTsConfig = $this->getBackendUser()->getTSConfig();
 
         /** @var RecordBrowserPageTreeView $pageTree */
         $pageTree = GeneralUtility::makeInstance(RecordBrowserPageTreeView::class);
         $pageTree->setLinkParameterProvider($this);
-        $pageTree->ext_showPageId = (bool)$backendUser->getTSConfigVal('options.pageTree.showPageIdWithTitle');
-        $pageTree->ext_showNavTitle = (bool)$backendUser->getTSConfigVal('options.pageTree.showNavTitle');
-        $pageTree->ext_showPathAboveMounts = (bool)$backendUser->getTSConfigVal('options.pageTree.showPathAboveMounts');
+        $pageTree->ext_showPageId = (bool)($userTsConfig['options.']['pageTree.']['showPageIdWithTitle'] ?? false);
+        $pageTree->ext_showNavTitle = (bool)($userTsConfig['options.']['pageTree.']['showNavTitle'] ?? false);
+        $pageTree->ext_showPathAboveMounts = (bool)($userTsConfig['options.']['pageTree.']['showPathAboveMounts'] ?? false);
         $pageTree->addField('nav_title');
 
         // Load the mount points, if any
index 0ff9149..df2a5c0 100644 (file)
@@ -435,11 +435,9 @@ class AbstractDatabaseRecordList extends AbstractRecordList
             ->expr();
         $permsClause = $expressionBuilder->andX($backendUser->getPagePermsClause(Permission::PAGE_SHOW));
         // This will hide records from display - it has nothing to do with user rights!!
-        if ($pidList = $backendUser->getTSConfigVal('options.hideRecords.pages')) {
-            $pidList = GeneralUtility::intExplode(',', $pidList, true);
-            if (!empty($pidList)) {
-                $permsClause->add($expressionBuilder->notIn('pages.uid', $pidList));
-            }
+        $pidList = GeneralUtility::intExplode(',', $backendUser->getTSConfig()['options.']['hideRecords.']['pages'] ?? '', true);
+        if (!empty($pidList)) {
+            $permsClause->add($expressionBuilder->notIn('pages.uid', $pidList));
         }
         $this->perms_clause = (string)$permsClause;
 
index c102581..ca26ba0 100644 (file)
@@ -1920,6 +1920,8 @@ class DatabaseRecordList
      */
     public function makeControl($table, $row)
     {
+        $backendUser = $this->getBackendUserAuthentication();
+        $userTsConfig = $backendUser->getTSConfig();
         $module = $this->getModule();
         $rowUid = $row['uid'];
         if (ExtensionManagementUtility::isLoaded('workspaces') && isset($row['_ORIG_uid'])) {
@@ -1935,14 +1937,14 @@ class DatabaseRecordList
         // If the listed table is 'pages' we have to request the permission settings for each page:
         $localCalcPerms = 0;
         if ($table === 'pages') {
-            $localCalcPerms = $this->getBackendUserAuthentication()->calcPerms(BackendUtility::getRecord('pages', $row['uid']));
+            $localCalcPerms = $backendUser->calcPerms(BackendUtility::getRecord('pages', $row['uid']));
         }
         $permsEdit = $table === 'pages'
-                     && $this->getBackendUserAuthentication()->checkLanguageAccess(0)
+                     && $backendUser->checkLanguageAccess(0)
                      && $localCalcPerms & Permission::PAGE_EDIT
                      || $table !== 'pages'
                         && $this->calcPerms & Permission::CONTENT_EDIT
-                        && $this->getBackendUserAuthentication()->recordEditAccessInternals($table, $row);
+                        && $backendUser->recordEditAccessInternals($table, $row);
         $permsEdit = $this->overlayEditLockPermissions($table, $row, $permsEdit);
         // "Show" link (only pages and tt_content elements)
         /** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
@@ -1996,9 +1998,7 @@ class DatabaseRecordList
         // If the table is NOT a read-only table, then show these links:
         if ($this->isEditable($table)) {
             // "Revert" link (history/undo)
-            $showHistoryTS = $this->getBackendUserAuthentication()->getTSConfig('options.showHistory');
-            $showHistory = (bool)trim($showHistoryTS['properties'][$table] ?? $showHistoryTS['value'] ?? '1');
-            if ($showHistory) {
+            if ((bool)\trim($userTsConfig['options.']['showHistory.'][$table] ?? $userTsConfig['options.']['showHistory'] ?? '1')) {
                 $moduleUrl = BackendUtility::getModuleUrl('record_history', ['element' => $table . ':' . $row['uid']]);
                 $onClick = 'return jumpExt(' . GeneralUtility::quoteJSvalue($moduleUrl) . ',\'#latest\');';
                 $historyAction = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars($onClick) . '" title="'
@@ -2007,7 +2007,7 @@ class DatabaseRecordList
                 $this->addActionToCellGroup($cells, $historyAction, 'history');
             }
             // "Edit Perms" link:
-            if ($table === 'pages' && $this->getBackendUserAuthentication()->check('modules', 'system_BeuserTxPermission') && ExtensionManagementUtility::isLoaded('beuser')) {
+            if ($table === 'pages' && $backendUser->check('modules', 'system_BeuserTxPermission') && ExtensionManagementUtility::isLoaded('beuser')) {
                 if ($isL10nOverlay) {
                     $permsAction = $this->spaceIcon;
                 } else {
@@ -2070,7 +2070,7 @@ class DatabaseRecordList
             if (
                 !empty($GLOBALS['TCA'][$table]['columns'][$hiddenField])
                 && (empty($GLOBALS['TCA'][$table]['columns'][$hiddenField]['exclude'])
-                    || $this->getBackendUserAuthentication()->check('non_exclude_fields', $table . ':' . $hiddenField))
+                    || $backendUser->check('non_exclude_fields', $table . ':' . $hiddenField))
             ) {
                 if (!$permsEdit || $this->isRecordCurrentBackendUser($table, $row)) {
                     $hideAction = $this->spaceIcon;
@@ -2096,11 +2096,10 @@ class DatabaseRecordList
                 $this->addActionToCellGroup($cells, $hideAction, 'hide');
             }
             // "Delete" link:
-            $disableDeleteTS = $this->getBackendUserAuthentication()->getTSConfig('options.disableDelete');
-            $disableDelete = (bool)trim($disableDeleteTS['properties'][$table] ?? $disableDeleteTS['value']);
+            $disableDelete = (bool)\trim($userTsConfig['options.']['disableDelete.'][$table] ?? $userTsConfig['options.']['disableDelete'] ?? '0');
             if ($permsEdit && !$disableDelete && ($table === 'pages' && $localCalcPerms & Permission::PAGE_DELETE || $table !== 'pages' && $this->calcPerms & Permission::CONTENT_EDIT)) {
                 // Check if the record version is in "deleted" state, because that will switch the action to "restore"
-                if ($this->getBackendUserAuthentication()->workspace > 0 && isset($row['t3ver_state']) && (int)$row['t3ver_state'] === 2) {
+                if ($backendUser->workspace > 0 && isset($row['t3ver_state']) && (int)$row['t3ver_state'] === 2) {
                     $actionName = 'restore';
                     $refCountMsg = '';
                 } else {
@@ -2150,7 +2149,7 @@ class DatabaseRecordList
                 }
                 // Down (Paste as subpage to the page right above)
                 if (!$isL10nOverlay && $this->currentTable['prevUid'][$row['uid']]) {
-                    $localCalcPerms = $this->getBackendUserAuthentication()->calcPerms(BackendUtility::getRecord('pages', $this->currentTable['prevUid'][$row['uid']]));
+                    $localCalcPerms = $backendUser->calcPerms(BackendUtility::getRecord('pages', $this->currentTable['prevUid'][$row['uid']]));
                     if ($localCalcPerms & Permission::PAGE_NEW) {
                         $params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . $this->currentTable['prevUid'][$row['uid']];
                         $moveRightAction = '<a class="btn btn-default" href="#" onclick="'
@@ -2946,11 +2945,9 @@ class DatabaseRecordList
             ->expr();
         $permsClause = $expressionBuilder->andX($backendUser->getPagePermsClause(Permission::PAGE_SHOW));
         // This will hide records from display - it has nothing to do with user rights!!
-        if ($pidList = $backendUser->getTSConfigVal('options.hideRecords.pages')) {
-            $pidList = GeneralUtility::intExplode(',', $pidList, true);
-            if (!empty($pidList)) {
-                $permsClause->add($expressionBuilder->notIn('pages.uid', $pidList));
-            }
+        $pidList = GeneralUtility::intExplode(',', $backendUser->getTSConfig()['options.']['hideRecords.']['pages'] ?? '', true);
+        if (!empty($pidList)) {
+            $permsClause->add($expressionBuilder->notIn('pages.uid', $pidList));
         }
         $this->perms_clause = (string)$permsClause;
 
index 6013d0c..9c8ff95 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Recordlist\View;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Backend\Routing\UriBuilder;
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Localization\LanguageService;
 use TYPO3\CMS\Core\Resource\Folder;
@@ -49,21 +50,19 @@ class FolderUtilityRenderer
      */
     public function createFolder(Folder $folderObject)
     {
-        if (!$folderObject->checkActionPermission('write')) {
-            return '';
-        }
         $backendUser = $this->getBackendUser();
-        if (!$backendUser->isAdmin() && !$backendUser->getTSConfigVal('options.createFoldersInEB')) {
-            return '';
-        }
-        // Don't show Folder-create form if it's denied
-        if ($backendUser->getTSConfigVal('options.folderTree.hideCreateFolder')) {
+        $userTsConfig = $backendUser->getTSConfig();
+        $lang = $this->getLanguageService();
+
+        if (!$folderObject->checkActionPermission('write')
+            || !$backendUser->isAdmin() && !($userTsConfig['options.']['createFoldersInEB'] ?? false)
+            || $userTsConfig['options.']['folderTree.']['hideCreateFolder'] ?? false
+        ) {
+            // Do not show create folder form if it is denied
             return '';
         }
-        $lang = $this->getLanguageService();
 
-        /** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
-        $uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
+        $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
         $formAction = (string)$uriBuilder->buildUriFromRoute('tce_file');
         $markup = [];
         $markup[] = '<form action="' . htmlspecialchars($formAction)
@@ -113,13 +112,11 @@ class FolderUtilityRenderer
             return '';
         }
         // Read configuration of upload field count
-        $userSetting = $this->getBackendUser()->getTSConfigVal('options.folderTree.uploadFieldsInLinkBrowser');
-        $count = isset($userSetting) ? (int)$userSetting : 1;
+        $count = (int)($this->getBackendUser()->getTSConfig()['options.']['folderTree.']['uploadFieldsInLinkBrowser'] ?? 1);
         if ($count === 0) {
             return '';
         }
 
-        $count = (int)$count === 0 ? 1 : (int)$count;
         // Create header, showing upload path:
         $header = $folderObject->getIdentifier();
         $lang = $this->getLanguageService();
@@ -131,8 +128,8 @@ class FolderUtilityRenderer
                     . strtoupper(htmlspecialchars($fileExt)) . '</span>';
             }
         }
-        /** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
-        $uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
+        /** @var UriBuilder $uriBuilder */
+        $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
         $formAction = (string)$uriBuilder->buildUriFromRoute('tce_file');
         $combinedIdentifier = $folderObject->getCombinedIdentifier();
         $markup = [];
index 7a2759c..4db21ad 100644 (file)
@@ -19,6 +19,7 @@ use Psr\Http\Message\ServerRequestInterface;
 use TYPO3\CMS\Core\Http\JsonResponse;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\MathUtility;
 use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
 use TYPO3\CMS\Fluid\View\StandaloneView;
 use TYPO3\CMS\Recycler\Domain\Model\DeletedRecords;
@@ -44,12 +45,10 @@ class RecyclerAjaxController
         // Configuration, variable assignment
         $this->conf['action'] = GeneralUtility::_GP('action');
         $this->conf['table'] = GeneralUtility::_GP('table') ? GeneralUtility::_GP('table') : '';
-        $modTS = $this->getBackendUser()->getTSConfig('mod.recycler');
-        if (isset($modTS['properties']['recordsPageLimit']) && (int)$modTS['properties']['recordsPageLimit'] > 0) {
-            $this->conf['limit'] = (int)$modTS['properties']['recordsPageLimit'];
-        } else {
-            $this->conf['limit'] = 25;
-        }
+        $this->conf['limit'] = MathUtility::forceIntegerInRange(
+            (int)($this->getBackendUser()->getTSConfig()['mod.']['recycler.']['recordsPageLimit'] ?? 25),
+            1
+        );
         $this->conf['start'] = GeneralUtility::_GP('start') ? (int)GeneralUtility::_GP('start') : 0;
         $this->conf['filterTxt'] = GeneralUtility::_GP('filterTxt') ? GeneralUtility::_GP('filterTxt') : '';
         $this->conf['startUid'] = GeneralUtility::_GP('startUid') ? (int)GeneralUtility::_GP('startUid') : 0;
index 051a8c8..bfc730e 100644 (file)
@@ -26,6 +26,7 @@ use TYPO3\CMS\Core\Imaging\Icon;
 use TYPO3\CMS\Core\Localization\LanguageService;
 use TYPO3\CMS\Core\Type\Bitmask\Permission;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\MathUtility;
 use TYPO3\CMS\Fluid\View\StandaloneView;
 
 /**
@@ -89,16 +90,16 @@ class RecyclerModuleController
         }
 
         // read configuration
-        $modTS = $backendUser->getTSConfig('mod.recycler');
-        if ($this->getBackendUser()->isAdmin()) {
+        if ($backendUser->isAdmin()) {
             $this->allowDelete = true;
         } else {
-            $this->allowDelete = (bool)$modTS['properties']['allowDelete'];
+            $this->allowDelete = (bool)($backendUser->getTSConfig()['mod.']['recycler.']['allowDelete'] ?? false);
         }
 
-        if (isset($modTS['properties']['recordsPageLimit']) && (int)$modTS['properties']['recordsPageLimit'] > 0) {
-            $this->recordsPageLimit = (int)$modTS['properties']['recordsPageLimit'];
-        }
+        $this->recordsPageLimit = MathUtility::forceIntegerInRange(
+            (int)($backendUser->getTSConfig()['mod.']['recycler.']['recordsPageLimit'] ?? 25),
+            1
+        );
 
         $action = 'index';
         $this->initializeView($action);
index a4e9137..a78cbe4 100644 (file)
@@ -345,9 +345,9 @@ class SetupModuleController
 
         $this->isAdmin = $scriptUser->isAdmin();
         // Getting the 'override' values as set might be set in User TSconfig
-        $this->overrideConf = $this->beUser->getTSConfigProp('setup.override');
+        $this->overrideConf = $this->beUser->getTSConfig()['setup.']['override.'] ?? null;
         // Getting the disabled fields might be set in User TSconfig (eg setup.fields.password.disabled=1)
-        $this->tsFieldConf = $this->beUser->getTSConfigProp('setup.fields');
+        $this->tsFieldConf = $this->beUser->getTSConfig()['setup.']['fields.'] ?? null;
         // id password is disabled, disable repeat of password too (password2)
         if (isset($this->tsFieldConf['password.']) && $this->tsFieldConf['password.']['disabled']) {
             $this->tsFieldConf['password2.']['disabled'] = 1;
index 3c5d5db..5a1b5ee 100644 (file)
@@ -422,22 +422,19 @@ class TaskModuleController extends BaseScriptClass
      * @param string $taskClass Name of the task
      * @return bool Access to the task allowed or not
      */
-    protected function checkAccess($extKey, $taskClass)
+    protected function checkAccess($extKey, $taskClass): bool
     {
-        // Check if task is blinded with TsConfig (taskcenter.<extkey>.<taskName>
-        $tsConfig = $this->getBackendUser()->getTSConfig('taskcenter.' . $extKey . '.' . $taskClass);
-        if (isset($tsConfig['value']) && (int)$tsConfig['value'] === 0) {
-            return false;
-        }
+        $backendUser = $this->getBackendUser();
         // Admins are always allowed
-        if ($this->getBackendUser()->isAdmin()) {
+        if ($backendUser->isAdmin()) {
             return true;
         }
         // Check if task is restricted to admins
         if ((int)$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['taskcenter'][$extKey][$taskClass]['admin'] === 1) {
             return false;
         }
-        return true;
+        // Check if task is blinded with TsConfig (taskcenter.<extkey>.<taskName>
+        return (bool)($backendUser->getTSConfig()['taskcenter.'][$extKey . '.'][$taskClass] ?? true);
     }
 
     /**
index 407af6e..534a00b 100644 (file)
@@ -279,13 +279,8 @@ class ViewModuleController
      */
     protected function getDomainName(int $pageId)
     {
-        $previewDomainConfig = $this->getBackendUser()->getTSConfig('TCEMAIN.previewDomain', BackendUtility::getPagesTSconfig($pageId));
-        if ($previewDomainConfig['value']) {
-            $domain = $previewDomainConfig['value'];
-        } else {
-            $domain = BackendUtility::firstDomainRecord(BackendUtility::BEgetRootLine($pageId));
-        }
-        return $domain;
+        $previewDomainConfig = BackendUtility::getPagesTSconfig($pageId)['TCEMAIN.']['previewDomain'] ?? '';
+        return $previewDomainConfig ?: BackendUtility::firstDomainRecord(BackendUtility::BEgetRootLine($pageId));
     }
 
     /**
index 8072db2..17a2478 100644 (file)
@@ -202,7 +202,7 @@ class PreviewController
     protected function generateJavascript(): string
     {
         // If another page module was specified, replace the default Page module with the new one
-        $pageModule = trim($this->getBackendUser()->getTSConfigVal('options.overridePageModule') ?? '');
+        $pageModule = \trim($this->getBackendUser()->getTSConfig()['options.']['overridePageModule'] ?? '');
         $pageModule = BackendUtility::isModuleSetInTBE_MODULES($pageModule) ? $pageModule : 'web_layout';
         if (!$this->getBackendUser()->check('modules', $pageModule)) {
             $pageModule = '';
index c767c53..8147cca 100644 (file)
@@ -54,13 +54,14 @@ class MassActionHandler
     {
         $actions = [];
         $currentWorkspace = $this->getCurrentWorkspace();
-        $massActionsEnabled = $this->getBackendUser()->getTSConfigVal('options.workspaces.enableMassActions') !== '0';
+        $backendUser = $this->getBackendUser();
+        $massActionsEnabled = (bool)($backendUser->getTSConfig()['options.']['workspaces.']['enableMassActions'] ?? true);
         // in case we're working within "All Workspaces" we can't provide Mass Actions
         if ($currentWorkspace != WorkspaceService::SELECT_ALL_WORKSPACES && $massActionsEnabled) {
-            $publishAccess = $this->getBackendUser()->workspacePublishAccess($currentWorkspace);
-            if ($publishAccess && !($this->getBackendUser()->workspaceRec['publish_access'] & 1)) {
+            $publishAccess = $backendUser->workspacePublishAccess($currentWorkspace);
+            if ($publishAccess && !($backendUser->workspaceRec['publish_access'] & 1)) {
                 $actions[] = ['action' => 'publish', 'title' => $this->getLanguageService()->sL($this->pathToLocallang . ':label_doaction_publish')];
-                if ($this->getBackendUser()->workspaceSwapAccess()) {
+                if ($backendUser->workspaceSwapAccess()) {
                     $actions[] = ['action' => 'swap', 'title' => $this->getLanguageService()->sL($this->pathToLocallang . ':label_doaction_swap')];
                 }
             }
index b608ed4..ddbab2e 100644 (file)
@@ -96,8 +96,8 @@ class CommandMap
         $this->setTceMain($tceMain);
         $this->set($commandMap);
         $this->setWorkspace($workspace);
-        $this->setWorkspacesSwapMode($this->getTceMain()->BE_USER->getTSConfigVal('options.workspaces.swapMode'));
-        $this->setWorkspacesChangeStageMode($this->getTceMain()->BE_USER->getTSConfigVal('options.workspaces.changeStageMode'));
+        $this->setWorkspacesSwapMode($this->getTceMain()->BE_USER->getTSConfig()['options.']['workspaces.']['swapMode'] ?? '');
+        $this->setWorkspacesChangeStageMode($this->getTceMain()->BE_USER->getTSConfig()['options.']['workspaces.']['changeStageMode'] ?? '');
         $this->constructScopes();
     }
 
index e7b141a..dd67341 100644 (file)
@@ -221,7 +221,7 @@ class PreviewUriBuilder
      */
     protected function getPreviewLinkLifetime(): int
     {
-        $ttlHours = (int)$this->getBackendUser()->getTSConfigVal('options.workspaces.previewLinkTTLHours');
+        $ttlHours = (int)($this->getBackendUser()->getTSConfig()['options.']['workspaces.']['previewLinkTTLHours'] ?? 0);
         return $ttlHours ?: 24 * 2;
     }