[BUGFIX] Remove TypoScript dependency of AdminPanelInitiator 47/57147/3
authorSusanne Moog <susanne.moog@typo3.org>
Fri, 8 Jun 2018 08:14:17 +0000 (10:14 +0200)
committerBenni Mack <benni@typo3.org>
Sat, 9 Jun 2018 19:50:57 +0000 (21:50 +0200)
The admin panel initialization is done via middleware before the
TypoScript is fully initialized, therefor it cannot have dependencies
to parsed TypoScript (and it cannot be initialized at a later state
because of cross-dependencies with TSFE).

Before #85104 the checks did not include TypoScript - that state has
been restored and the dependency has been removed.

Resolves: #85193
Releases: master
Change-Id: Ic576b02a68ddc20f52b4b1647b0e38c51e1b7df8
Reviewed-on: https://review.typo3.org/57147
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/adminpanel/Classes/Middleware/AdminPanelInitiator.php
typo3/sysext/adminpanel/Tests/Unit/Middleware/AdminPanelInitiatorTest.php

index 0a42704..b36880f 100644 (file)
@@ -48,8 +48,7 @@ class AdminPanelInitiator implements MiddlewareInterface
             $beUser->extAdminConfig = $beUser->getTSConfig()['admPanel.'] ?? [];
             $adminPanelConfiguration = $beUser->extAdminConfig;
             if (isset($adminPanelConfiguration['enable.']) &&
-                ($beUser->uc['TSFE_adminConfig']['display_top'] ?? false) &&
-                ($GLOBALS['TSFE']->config['config']['admPanel'] ?? false)
+                ($beUser->uc['TSFE_adminConfig']['display_top'] ?? false)
             ) {
                 // only initialize if at least one module is enabled.
                 foreach ($adminPanelConfiguration['enable.'] as $value) {
index e0436c9..6bc08c3 100644 (file)
@@ -35,18 +35,12 @@ class AdminPanelInitiatorTest extends UnitTestCase
                 'display_top' => true
             ]
         ];
-        $typoScript = [
-            'config' => [
-                'admPanel' => 1
-            ]
-        ];
         $userAuthentication = $this->prophesize(FrontendBackendUserAuthentication::class);
         $userAuthentication->getTSConfig(Argument::any())->willReturn($tsConfig);
         $userAuthentication->uc = $uc;
         $GLOBALS['BE_USER'] = $userAuthentication->reveal();
 
         $tsfe = $this->prophesize(TypoScriptFrontendController::class);
-        $tsfe->config = $typoScript;
         $GLOBALS['TSFE'] = $tsfe;
 
         $controller = $this->prophesize(MainController::class);
@@ -67,31 +61,6 @@ class AdminPanelInitiatorTest extends UnitTestCase
     /**
      * @test
      */
-    public function processDoesNotCallInitializeIfAdminPanelIsNotEnabledInTypoScript(): void
-    {
-        $tsConfig = [
-            'admPanel.' => [
-                'enable.' => [
-                    'all',
-                ],
-            ],
-        ];
-        $uc = [
-            'TSFE_adminConfig' => [
-                'display_top' => true
-            ]
-        ];
-        $typoScript = [
-            'config' => [
-                'admPanel' => 0
-            ]
-        ];
-        $this->checkAdminPanelDoesNotCallInitialize($tsConfig, $uc, $typoScript);
-    }
-
-    /**
-     * @test
-     */
     public function processDoesNotCallInitializeIfAdminPanelIsNotEnabledInUC(): void
     {
         $tsConfig = [
@@ -106,12 +75,7 @@ class AdminPanelInitiatorTest extends UnitTestCase
                 'display_top' => false
             ]
         ];
-        $typoScript = [
-            'config' => [
-                'admPanel' => 1
-            ]
-        ];
-        $this->checkAdminPanelDoesNotCallInitialize($tsConfig, $uc, $typoScript);
+        $this->checkAdminPanelDoesNotCallInitialize($tsConfig, $uc);
     }
 
     /**
@@ -127,12 +91,7 @@ class AdminPanelInitiatorTest extends UnitTestCase
                 'display_top' => true
             ]
         ];
-        $typoScript = [
-            'config' => [
-                'admPanel' => 1
-            ]
-        ];
-        $this->checkAdminPanelDoesNotCallInitialize($tsConfig, $uc, $typoScript);
+        $this->checkAdminPanelDoesNotCallInitialize($tsConfig, $uc);
     }
 
     /**
@@ -140,7 +99,7 @@ class AdminPanelInitiatorTest extends UnitTestCase
      * @param $uc
      * @param $typoScript
      */
-    protected function checkAdminPanelDoesNotCallInitialize($tsConfig, $uc, $typoScript): void
+    protected function checkAdminPanelDoesNotCallInitialize($tsConfig, $uc): void
     {
         $userAuthentication = $this->prophesize(FrontendBackendUserAuthentication::class);
         $userAuthentication->getTSConfig(Argument::any())->willReturn($tsConfig);
@@ -148,7 +107,6 @@ class AdminPanelInitiatorTest extends UnitTestCase
         $GLOBALS['BE_USER'] = $userAuthentication->reveal();
 
         $tsfe = $this->prophesize(TypoScriptFrontendController::class);
-        $tsfe->config = $typoScript;
         $GLOBALS['TSFE'] = $tsfe;
 
         $controller = $this->prophesize(MainController::class);