‪TYPO3CMS  ‪main
BackendModuleController.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use Psr\Http\Message\ResponseInterface;
21 use Psr\Http\Message\ServerRequestInterface;
27 use TYPO3\CMS\Install\Service\SessionService;
28 
41 {
42  public function ‪__construct(
43  protected readonly ‪ModuleTemplateFactory $moduleTemplateFactory,
44  protected readonly SessionService $sessionService
45  ) {}
46 
50  public function ‪maintenanceAction(ServerRequestInterface $request): ResponseInterface
51  {
52  return $this->‪setAuthorizedAndRedirect('maintenance', $request);
53  }
54 
58  public function ‪settingsAction(ServerRequestInterface $request): ResponseInterface
59  {
60  return $this->‪setAuthorizedAndRedirect('settings', $request);
61  }
62 
66  public function ‪upgradeAction(ServerRequestInterface $request): ResponseInterface
67  {
68  return $this->‪setAuthorizedAndRedirect('upgrade', $request);
69  }
70 
74  public function ‪environmentAction(ServerRequestInterface $request): ResponseInterface
75  {
76  return $this->‪setAuthorizedAndRedirect('environment', $request);
77  }
78 
83  protected function ‪setAuthorizedAndRedirect(string $controller, ServerRequestInterface $request): ResponseInterface
84  {
85  $userSession = $this->‪getBackendUser()->getSession();
86  $this->sessionService->installSessionHandler();
87  $this->sessionService->startSession();
88  $this->sessionService->setAuthorizedBackendSession($userSession);
89  $entryPointResolver = GeneralUtility::makeInstance(BackendEntryPointResolver::class);
90  $redirectLocation = $entryPointResolver->getUriFromRequest($request, 'install.php')->withQuery('?install[controller]=' . $controller . '&install[context]=backend');
91  return new ‪RedirectResponse($redirectLocation, 303);
92  }
93 
95  {
96  return ‪$GLOBALS['BE_USER'];
97  }
98 }
‪TYPO3\CMS\Backend\Template\ModuleTemplateFactory
Definition: ModuleTemplateFactory.php:33
‪TYPO3\CMS\Install\Controller\BackendModuleController\settingsAction
‪settingsAction(ServerRequestInterface $request)
Definition: BackendModuleController.php:58
‪TYPO3\CMS\Install\Controller\BackendModuleController\setAuthorizedAndRedirect
‪setAuthorizedAndRedirect(string $controller, ServerRequestInterface $request)
Definition: BackendModuleController.php:83
‪TYPO3\CMS\Install\Controller\BackendModuleController\__construct
‪__construct(protected readonly ModuleTemplateFactory $moduleTemplateFactory, protected readonly SessionService $sessionService)
Definition: BackendModuleController.php:42
‪TYPO3\CMS\Install\Controller\BackendModuleController\getBackendUser
‪getBackendUser()
Definition: BackendModuleController.php:94
‪TYPO3\CMS\Install\Controller\BackendModuleController\upgradeAction
‪upgradeAction(ServerRequestInterface $request)
Definition: BackendModuleController.php:66
‪TYPO3\CMS\Install\Controller\BackendModuleController\maintenanceAction
‪maintenanceAction(ServerRequestInterface $request)
Definition: BackendModuleController.php:50
‪TYPO3\CMS\Install\Controller\BackendModuleController\environmentAction
‪environmentAction(ServerRequestInterface $request)
Definition: BackendModuleController.php:74
‪TYPO3\CMS\Install\Controller
Definition: AbstractController.php:18
‪TYPO3\CMS\Core\Authentication\BackendUserAuthentication
Definition: BackendUserAuthentication.php:62
‪TYPO3\CMS\Core\Http\RedirectResponse
Definition: RedirectResponse.php:30
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:52
‪TYPO3\CMS\Core\Routing\BackendEntryPointResolver
Definition: BackendEntryPointResolver.php:29
‪TYPO3\CMS\Install\Controller\BackendModuleController
Definition: BackendModuleController.php:41