[BUGFIX] Extbase should not use deprecated CLI admin role methods 88/52188/3
authorBenni Mack <benni@typo3.org>
Mon, 27 Mar 2017 16:15:26 +0000 (18:15 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Mon, 27 Mar 2017 18:45:59 +0000 (20:45 +0200)
Resolves: #80492
Releases: master
Change-Id: Id835329586bf0fa315dc46377bc195ace005da61
Reviewed-on: https://review.typo3.org/52188
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Mona Muzaffar <mona.muzaffar@gmx.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/extbase/Classes/Mvc/Controller/CommandController.php
typo3/sysext/extbase/Tests/Unit/Mvc/Controller/CommandControllerTest.php

index 741debf..4c286f8 100644 (file)
@@ -249,9 +249,7 @@ class CommandController implements CommandControllerInterface
         foreach ($this->arguments as $argument) {
             $preparedArguments[] = $argument->getValue();
         }
-        $originalRole = $this->ensureAdminRoleIfRequested();
         $commandResult = call_user_func_array([$this, $this->commandMethodName], $preparedArguments);
-        $this->restoreUserRole($originalRole);
         if (is_string($commandResult) && $commandResult !== '') {
             $this->response->appendContent($commandResult);
         } elseif (is_object($commandResult) && method_exists($commandResult, '__toString')) {
index 94788ad..0923e85 100644 (file)
@@ -79,30 +79,4 @@ class CommandControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCa
         $this->commandController->_set('response', $mockResponse);
         $this->commandController->_call('quit', 123);
     }
-
-    /**
-     * @test
-     */
-    public function settingRequestAdminPropertySetsAdminRoleInUserAuthentication()
-    {
-        $mockedUserAuthentication = $this->createMock(\TYPO3\CMS\Core\Authentication\AbstractUserAuthentication::class);
-        $mockedUserAuthentication->user['admin'] = 42;
-        $this->commandController->expects($this->once())
-            ->method('dummyCommand')
-            ->will(
-                $this->returnCallback(
-                    function () use ($mockedUserAuthentication) {
-                        if ($mockedUserAuthentication->user['admin'] !== 1) {
-                            throw new \Exception('User role is not admin', 1476050222);
-                        }
-                    }
-                ));
-        $GLOBALS['BE_USER'] = $mockedUserAuthentication;
-        $this->commandController->_set('arguments', []);
-        $this->commandController->_set('commandMethodName', 'dummyCommand');
-        $this->commandController->_set('requestAdminPermissions', true);
-        $this->commandController->_call('callCommandMethod');
-
-        $this->assertSame(42, $mockedUserAuthentication->user['admin']);
-    }
 }