diff --git a/typo3/sysext/extbase/Classes/Mvc/Controller/CommandController.php b/typo3/sysext/extbase/Classes/Mvc/Controller/CommandController.php index 741debf70f3ded8425449268473b31f4569de702..4c286f8d7c8d8f0949e951d1e6d4129ad05ed413 100644 --- a/typo3/sysext/extbase/Classes/Mvc/Controller/CommandController.php +++ b/typo3/sysext/extbase/Classes/Mvc/Controller/CommandController.php @@ -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')) { diff --git a/typo3/sysext/extbase/Tests/Unit/Mvc/Controller/CommandControllerTest.php b/typo3/sysext/extbase/Tests/Unit/Mvc/Controller/CommandControllerTest.php index 94788ad1144ed3bdf4aa9d4232ebc479a780db80..0923e85e0cb620ad704faf2ead03d5c83d7e861f 100644 --- a/typo3/sysext/extbase/Tests/Unit/Mvc/Controller/CommandControllerTest.php +++ b/typo3/sysext/extbase/Tests/Unit/Mvc/Controller/CommandControllerTest.php @@ -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']); - } }