diff --git a/Build/phpstan/phpstan-baseline.neon b/Build/phpstan/phpstan-baseline.neon index 2dcc7ebcda88b15ee9bd147025635474ad74b3b9..b050b569ae82b898120fbfa45875508bdd4ce55e 100644 --- a/Build/phpstan/phpstan-baseline.neon +++ b/Build/phpstan/phpstan-baseline.neon @@ -280,11 +280,6 @@ parameters: count: 1 path: ../../typo3/sysext/core/Classes/Authentication/AuthenticationService.php - - - message: "#^Offset 'access' on array on left side of \\?\\? always exists and is not nullable\\.$#" - count: 1 - path: ../../typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php - - message: "#^Parameter \\#1 \\$key1 of method Redis\\:\\:sUnion\\(\\) expects string, array\\<int\\<0, max\\>, string\\> given\\.$#" count: 1 diff --git a/typo3/sysext/backend/Classes/Utility/BackendUtility.php b/typo3/sysext/backend/Classes/Utility/BackendUtility.php index aaae4be9777598ef0736be40323248573f5ca5e9..e8906a425e48abd0c8a2fac60a8663844f53630d 100644 --- a/typo3/sysext/backend/Classes/Utility/BackendUtility.php +++ b/typo3/sysext/backend/Classes/Utility/BackendUtility.php @@ -21,7 +21,6 @@ use Psr\Http\Message\ServerRequestInterface; use Psr\Log\LoggerInterface; use TYPO3\CMS\Backend\Configuration\TranslationConfigurationProvider; use TYPO3\CMS\Backend\Domain\Model\Element\ImmediateActionElement; -use TYPO3\CMS\Backend\Module\ModuleProvider; use TYPO3\CMS\Backend\Routing\Route; use TYPO3\CMS\Backend\Routing\UriBuilder; use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; @@ -2713,23 +2712,6 @@ class BackendUtility return GeneralUtility::makeInstance(CacheManager::class)->getCache('runtime'); } - /** - * Returns TRUE if $modName is set and is found as a main- or submodule in $TBE_MODULES array - * - * @param string $modName Module name - * @return bool - * @deprecated no longer in use. Will be removed in v13. Use the ModuleProvider API instead. - */ - public static function isModuleSetInTBE_MODULES($modName) - { - trigger_error( - 'BackendUtility::isModuleSetInTBE_MODULES() will be removed in TYPO3 v13.0. Use the ModuleProvider API instead.', - E_USER_DEPRECATED - ); - - return GeneralUtility::makeInstance(ModuleProvider::class)->isModuleRegistered((string)$modName); - } - /** * Counting references to a record/file * diff --git a/typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php b/typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php index 4c976e9fa4a38f336287f3cbf2b88508716c2944..48042aaf8e2859459ff44dc5ba00f6e19f580133 100644 --- a/typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php +++ b/typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php @@ -17,7 +17,6 @@ namespace TYPO3\CMS\Core\Authentication; use Psr\EventDispatcher\EventDispatcherInterface; use Psr\Http\Message\ServerRequestInterface; -use TYPO3\CMS\Backend\Module\ModuleProvider; use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Core\Authentication\Event\AfterUserLoggedInEvent; use TYPO3\CMS\Core\Cache\CacheManager; @@ -378,54 +377,6 @@ class BackendUserAuthentication extends AbstractUserAuthentication return null; } - /** - * Checks access to a backend module - * - * @param array $conf module configuration - * @throws \RuntimeException - * @return bool Will return TRUE if $MCONF['access'] is not set at all, if the BE_USER is admin or if the module is enabled in the be_users/be_groups records of the user (specifically enabled). Will return FALSE if the module name is not even registered - * @deprecated no longer in use. Will be removed in v13. Use the ModuleProvider API instead. - */ - public function modAccess($conf) - { - trigger_error( - 'BackendUserAuthentication->modAccess() will be removed in TYPO3 v13.0. Use the ModuleProvider API instead.', - E_USER_DEPRECATED - ); - - $moduleName = $conf['name'] ?? ''; - if (!GeneralUtility::makeInstance(ModuleProvider::class)->isModuleRegistered($moduleName)) { - throw new \RuntimeException('Fatal Error: This module "' . $moduleName . '" is not registered.', 1294586446); - } - // Workspaces check: - if ( - !empty($conf['workspaces']) - && ExtensionManagementUtility::isLoaded('workspaces') - && ($this->workspace !== 0 || !GeneralUtility::inList($conf['workspaces'], 'online')) - && ($this->workspace <= 0 || !GeneralUtility::inList($conf['workspaces'], 'custom')) - ) { - throw new \RuntimeException('Workspace Error: This module "' . $moduleName . '" is not available under the current workspace', 1294586447); - } - // Throws exception if conf[access] is set to system maintainer and the user is no system maintainer - if (str_contains($conf['access'] ?? '', self::ROLE_SYSTEMMAINTAINER) && !$this->isSystemMaintainer()) { - throw new \RuntimeException('This module "' . $moduleName . '" is only available as system maintainer', 1504804727); - } - // Returns TRUE if conf[access] is not set at all or if the user is admin - if (!($conf['access'] ?? false) || $this->isAdmin()) { - return true; - } - // If $conf['access'] is set but not with 'admin' then we return TRUE, if the module is found in the modList - $acs = false; - if ($moduleName && !str_contains($conf['access'] ?? '', 'admin')) { - $acs = GeneralUtility::makeInstance(ModuleProvider::class)->accessGranted($moduleName, $this); - } - if (!$acs) { - throw new \RuntimeException('Access Error: You don\'t have access to this module.', 1294586448); - } - // User has access (Otherwise an exception would haven been thrown) - return true; - } - /** * Checks if the user is in the valid list of allowed system maintainers. if the list is not set, * then all admins are system maintainers. If the list is empty, no one is system maintainer (good for production diff --git a/typo3/sysext/core/Documentation/Changelog/13.0/Breaking-100963-DeprecatedFunctionalityRemoved.rst b/typo3/sysext/core/Documentation/Changelog/13.0/Breaking-100963-DeprecatedFunctionalityRemoved.rst index 62c1c022bf6e800332c56cf08ef315a41623d9df..c9de6ab447386990ab70c6d3565f37f1099fb570 100644 --- a/typo3/sysext/core/Documentation/Changelog/13.0/Breaking-100963-DeprecatedFunctionalityRemoved.rst +++ b/typo3/sysext/core/Documentation/Changelog/13.0/Breaking-100963-DeprecatedFunctionalityRemoved.rst @@ -48,6 +48,7 @@ The following PHP class methods that have previously been marked as deprecated f - :php:`\TYPO3\CMS\Backend\Template\ModuleTemplate->registerModuleMenu` - :php:`\TYPO3\CMS\Backend\Template\ModuleTemplate->renderContent` - :php:`\TYPO3\CMS\Backend\Template\ModuleTemplate->setContent` +- :php:`\TYPO3\CMS\Core\Authentication\BackendUserAuthentication->modAccess` - :php:`\TYPO3\CMS\Core\Environment->getBackendPath` - :php:`\TYPO3\CMS\Extbase\Configuration\ConfigurationManager->isFeatureEnabled` - :php:`\TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication->getUserTSconf` @@ -65,6 +66,7 @@ The following PHP static class methods that have previously been marked as depre - :php:`\TYPO3\CMS\Backend\Utility\BackendUtility::getDropdownMenu` - :php:`\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck` - :php:`\TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu` +- :php:`\TYPO3\CMS\Backend\Utility\BackendUtility::isModuleSetInTBE_MODULES` The following methods changed signature according to previous deprecations in v12 at the end of the argument list: diff --git a/typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallMatcher.php b/typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallMatcher.php index 244194c57863e4473fdf7cf10613a6970c4cb58a..c72b736b1895109156dc785bc3125b6dc488ebd3 100644 --- a/typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallMatcher.php +++ b/typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallMatcher.php @@ -5167,6 +5167,7 @@ return [ 'maximumNumberOfArguments' => 1, 'restFiles' => [ 'Deprecation-96733-DeprecatedTBE_MODULESRelatedFunctionality.rst', + 'Breaking-100963-DeprecatedFunctionalityRemoved.rst', ], ], 'TYPO3\CMS\Backend\Template\ModuleTemplate->renderContent' => [ diff --git a/typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallStaticMatcher.php b/typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallStaticMatcher.php index 3f564672127b79a4ff02eb32b3b767643f278353..2be5e04a49ebbe41b50fab3ce0b52c08387406e3 100644 --- a/typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallStaticMatcher.php +++ b/typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallStaticMatcher.php @@ -1334,6 +1334,7 @@ return [ 'maximumNumberOfArguments' => 1, 'restFiles' => [ 'Deprecation-96733-DeprecatedTBE_MODULESRelatedFunctionality.rst', + 'Breaking-100963-DeprecatedFunctionalityRemoved.rst', ], ], 'TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule' => [