[FEATURE] Backend ViewHelpers for edit creation and editing
[Packages/TYPO3.CMS.git] / typo3 / sysext / beuser / Classes / Controller / BackendUserGroupController.php
1 <?php
2 namespace TYPO3\CMS\Beuser\Controller;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 use TYPO3\CMS\Core\Utility\GeneralUtility;
18
19 /**
20 * Backend module user group administration controller
21 */
22 class BackendUserGroupController extends BackendUserActionController
23 {
24 /**
25 * @var \TYPO3\CMS\Beuser\Domain\Repository\BackendUserGroupRepository
26 */
27 protected $backendUserGroupRepository;
28
29 /**
30 * @param \TYPO3\CMS\Beuser\Domain\Repository\BackendUserGroupRepository $backendUserGroupRepository
31 */
32 public function injectBackendUserGroupRepository(\TYPO3\CMS\Beuser\Domain\Repository\BackendUserGroupRepository $backendUserGroupRepository)
33 {
34 $this->backendUserGroupRepository = $backendUserGroupRepository;
35 }
36
37 /**
38 * Initialize actions
39 *
40 * @throws \RuntimeException
41 */
42 public function initializeAction()
43 {
44 // @TODO: Extbase backend modules relies on frontend TypoScript for view, persistence
45 // and settings. Thus, we need a TypoScript root template, that then loads the
46 // ext_typoscript_setup.txt file of this module. This is nasty, but can not be
47 // circumvented until there is a better solution in extbase.
48 // For now we throw an exception if no settings are detected.
49 if (empty($this->settings)) {
50 throw new \RuntimeException('No settings detected. This module can not work then. This usually happens if there is no frontend TypoScript template with root flag set. ' . 'Please create a frontend page with a TypoScript root template.', 1460976089);
51 }
52 }
53
54 /**
55 * Displays all BackendUserGroups
56 */
57 public function indexAction()
58 {
59 /** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
60 $uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
61 $this->view->assign('backendUserGroups', $this->backendUserGroupRepository->findAll());
62 $this->view->assign('returnUrl', (string)$uriBuilder->buildUriFromRoute(
63 'system_BeuserTxBeuser',
64 [
65 'tx_beuser_system_beusertxbeuser' => [
66 'action' => 'index',
67 'controller' => 'BackendUserGroup'
68 ]
69 ]
70 ));
71 }
72 }