‪TYPO3CMS  ‪main
BackendUserController.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;
23 use ‪TYPO3\CMS\Backend\Routing\UriBuilder as BackendUriBuilder;
38 use TYPO3\CMS\Core\Imaging\IconSize;
50 
57 {
58  protected ?‪ModuleData ‪$moduleData = null;
60 
61  public function ‪__construct(
62  protected readonly ‪BackendUserRepository $backendUserRepository,
63  protected readonly ‪BackendUserGroupRepository $backendUserGroupRepository,
64  protected readonly ‪BackendUserSessionRepository $backendUserSessionRepository,
65  protected readonly ‪UserInformationService $userInformationService,
66  protected readonly ‪ModuleTemplateFactory $moduleTemplateFactory,
67  protected readonly BackendUriBuilder $backendUriBuilder,
68  protected readonly ‪IconFactory $iconFactory,
69  protected readonly ‪PageRenderer $pageRenderer,
70  protected readonly ‪FileMountRepository $fileMountRepository
71  ) {}
72 
76  public function ‪processRequest(‪RequestInterface ‪$request): ResponseInterface
77  {
80  ‪$moduleData = ‪$request->getAttribute('moduleData');
81  if (
82  isset(‪$arguments['action'])
83  && in_array((string)‪$arguments['action'], ['index', 'groups', 'online', 'filemounts'])
84  && (string)‪$moduleData->‪get('defaultAction') !== (string)‪$arguments['action']
85  ) {
86  ‪$moduleData->‪set('defaultAction', (string)‪$arguments['action']);
87  $this->‪getBackendUser()->pushModuleData($moduleData->‪getModuleIdentifier(), ‪$moduleData->‪toArray());
88  } elseif (
89  !isset(‪$arguments['action'])
90  && ‪$moduleData->‪has('defaultAction')
91  && in_array((string)‪$moduleData->‪get('defaultAction'), ['index', 'groups', 'online', 'filemounts'])
92  ) {
94  }
95  return parent::processRequest(‪$request);
96  }
97 
104  public function ‪initializeAction(): void
105  {
106  $this->moduleData = $this->request->getAttribute('moduleData');
107  $this->moduleTemplate = $this->moduleTemplateFactory->create($this->request);
108  $this->moduleTemplate->setTitle(‪LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod.xlf:mlang_tabs_tab'));
109  $this->moduleTemplate->setFlashMessageQueue($this->‪getFlashMessageQueue());
110  }
111 
115  protected function ‪initializeView(): void
116  {
117  $this->moduleTemplate->assignMultiple([
118  'dateFormat' => ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'],
119  'timeFormat' => ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'],
120  ]);
121  // Load JavaScript modules
122  $this->pageRenderer->loadJavaScriptModule('@typo3/backend/context-menu.js');
123  $this->pageRenderer->loadJavaScriptModule('@typo3/backend/modal.js');
124  $this->pageRenderer->loadJavaScriptModule('@typo3/beuser/backend-user-listing.js');
125  }
126 
130  public function ‪indexAction(?‪Demand $demand = null, int $currentPage = 1, string $operation = ''): ResponseInterface
131  {
132  $backendUser = $this->‪getBackendUser();
133 
134  if ($operation === 'reset-filters') {
135  // Reset the module data demand object
136  $this->moduleData->set('demand', []);
137  $demand = null;
138  }
139  if ($demand === null) {
140  $demand = ‪Demand::fromUc((array)$this->moduleData->get('demand', []));
141  } else {
142  $this->moduleData->set('demand', $demand->forUc());
143  }
144  $backendUser->pushModuleData($this->moduleData->getModuleIdentifier(), $this->moduleData->toArray());
145 
146  $compareUserList = array_keys((array)$this->moduleData->get('compareUserList', []));
147 
148  $backendUsers = $this->backendUserRepository->findDemanded($demand);
149  $paginator = new ‪QueryResultPaginator($backendUsers, $currentPage, 50);
150  $pagination = new ‪SimplePagination($paginator);
151 
152  $this->moduleTemplate->assignMultiple([
153  'onlineBackendUsers' => $this->‪getOnlineBackendUsers(),
154  'demand' => $demand,
155  'paginator' => $paginator,
156  'pagination' => $pagination,
157  'totalAmountOfBackendUsers' => $backendUsers->count(),
158  'backendUserGroups' => array_merge([''], $this->backendUserGroupRepository->findAll()->toArray()),
159  'compareUserUidList' => array_combine($compareUserList, $compareUserList),
160  'currentUserUid' => $backendUser->user['uid'] ?? null,
161  'compareUserList' => !empty($compareUserList) ? $this->backendUserRepository->findByUidList($compareUserList) : '',
162  ]);
163 
164  $this->‪addMainMenu('index');
165  $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
166  $addUserButton = $buttonBar->makeLinkButton()
167  ->setIcon($this->iconFactory->getIcon('actions-plus', IconSize::SMALL))
168  ->setTitle(‪LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang.xlf:backendUser.create', 'beuser'))
169  ->setShowLabelText(true)
170  ->setHref((string)$this->backendUriBuilder->buildUriFromRoute('record_edit', [
171  'edit' => ['be_users' => [0 => 'new']],
172  'returnUrl' => $this->request->getAttribute('normalizedParams')->getRequestUri(),
173  ]));
174  $buttonBar->addButton($addUserButton);
175  $shortcutButton = $buttonBar->makeShortcutButton()
176  ->setRouteIdentifier('backend_user_management')
177  ->setArguments(['action' => 'index'])
178  ->setDisplayName(‪LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang.xlf:backendUsers', 'beuser'));
179  $buttonBar->addButton($shortcutButton, ‪ButtonBar::BUTTON_POSITION_RIGHT);
180 
181  $this->pageRenderer->loadJavaScriptModule('@typo3/backend/switch-user.js');
182 
183  return $this->moduleTemplate->renderResponse('BackendUser/List');
184  }
185 
189  public function ‪onlineAction(): ResponseInterface
190  {
191  $onlineUsersAndSessions = [];
192  $onlineUsers = $this->backendUserRepository->findOnline();
193  foreach ($onlineUsers as $onlineUser) {
194  $onlineUsersAndSessions[] = [
195  'backendUser' => $onlineUser,
196  'sessions' => $this->backendUserSessionRepository->findByBackendUser($onlineUser),
197  ];
198  }
199 
200  $currentSessionId = $this->backendUserSessionRepository->getPersistedSessionIdentifier($this->‪getBackendUser());
201 
202  $this->moduleTemplate->assignMultiple([
203  'onlineUsersAndSessions' => $onlineUsersAndSessions,
204  'currentSessionId' => $currentSessionId,
205  ]);
206 
207  $this->‪addMainMenu('online');
208  $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
209  $shortcutButton = $buttonBar->makeShortcutButton()
210  ->setRouteIdentifier('backend_user_management')
211  ->setArguments(['action' => 'online'])
212  ->setDisplayName(‪LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang.xlf:onlineUsers', 'beuser'));
213  $buttonBar->addButton($shortcutButton, ‪ButtonBar::BUTTON_POSITION_RIGHT);
214 
215  return $this->moduleTemplate->renderResponse('BackendUser/Online');
216  }
217 
218  public function ‪showAction(int ‪$uid = 0): ResponseInterface
219  {
220  $data = $this->userInformationService->getUserInformation(‪$uid);
221  $this->moduleTemplate->assign('data', $data);
222 
223  $this->‪addMainMenu('show');
224  $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
225  $backButton = $buttonBar->makeLinkButton()
226  ->setIcon($this->iconFactory->getIcon('actions-view-go-back', IconSize::SMALL))
227  ->setTitle(‪LocalizationUtility::translate('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.goBack'))
228  ->setShowLabelText(true)
229  ->setHref((string)$this->backendUriBuilder->buildUriFromRoute('backend_user_management'));
230  $buttonBar->addButton($backButton, ‪ButtonBar::BUTTON_POSITION_LEFT, 1);
231  $editButton = $buttonBar->makeLinkButton()
232  ->setIcon($this->iconFactory->getIcon('actions-open', IconSize::SMALL))
233  ->setTitle(‪LocalizationUtility::translate('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.edit'))
234  ->setShowLabelText(true)
235  ->setHref((string)$this->backendUriBuilder->buildUriFromRoute('record_edit', [
236  'edit' => ['be_users' => [‪$uid => 'edit']],
237  'returnUrl' => $this->request->getAttribute('normalizedParams')->getRequestUri(),
238  ]));
239  $buttonBar->addButton($editButton, ‪ButtonBar::BUTTON_POSITION_LEFT, 2);
240  $addUserButton = $buttonBar->makeLinkButton()
241  ->setIcon($this->iconFactory->getIcon('actions-plus', IconSize::SMALL))
242  ->setTitle(‪LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang.xlf:backendUser.create', 'beuser'))
243  ->setShowLabelText(true)
244  ->setHref((string)$this->backendUriBuilder->buildUriFromRoute('record_edit', [
245  'edit' => ['be_users' => [0 => 'new']],
246  'returnUrl' => $this->request->getAttribute('normalizedParams')->getRequestUri(),
247  ]));
248  $buttonBar->addButton($addUserButton, ‪ButtonBar::BUTTON_POSITION_LEFT, 3);
249  $username = empty($data['user']['username']) ? '' : ': ' . $data['user']['username'];
250  $shortcutButton = $buttonBar->makeShortcutButton()
251  ->setRouteIdentifier('backend_user_management')
252  ->setArguments(['action' => 'show', 'uid' => ‪$uid])
253  ->setDisplayName(‪LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang.xlf:backendUser', 'beuser') . $username);
254  $buttonBar->addButton($shortcutButton, ‪ButtonBar::BUTTON_POSITION_RIGHT);
255 
256  return $this->moduleTemplate->renderResponse('BackendUser/Show');
257  }
258 
262  public function ‪compareAction(): ResponseInterface
263  {
264  $compareUserList = array_keys((array)$this->moduleData->get('compareUserList', []));
265  if (empty($compareUserList)) {
266  return $this->‪redirect('index');
267  }
268 
269  $compareData = [];
270  foreach ($compareUserList as ‪$uid) {
271  if ($compareInformation = $this->userInformationService->getUserInformation(‪$uid)) {
272  $compareData[] = $compareInformation;
273  }
274  }
275 
276  $this->moduleTemplate->assignMultiple([
277  'compareUserList' => $compareData,
278  'onlineBackendUsers' => $this->‪getOnlineBackendUsers(),
279  ]);
280 
281  $this->‪addMainMenu('compare');
282  $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
283  $backButton = $buttonBar->makeLinkButton()
284  ->setIcon($this->iconFactory->getIcon('actions-view-go-back', IconSize::SMALL))
285  ->setTitle(‪LocalizationUtility::translate('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.goBack'))
286  ->setShowLabelText(true)
287  ->setHref((string)$this->backendUriBuilder->buildUriFromRoute('backend_user_management'));
288  $buttonBar->addButton($backButton);
289  $shortcutButton = $buttonBar->makeShortcutButton()
290  ->setRouteIdentifier('backend_user_management')
291  ->setArguments(['action' => 'compare'])
292  ->setDisplayName(‪LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang.xlf:compareUsers', 'beuser'));
293  $buttonBar->addButton($shortcutButton, ‪ButtonBar::BUTTON_POSITION_RIGHT);
294 
295  return $this->moduleTemplate->renderResponse('BackendUser/Compare');
296  }
297 
301  public function ‪initiatePasswordResetAction(int $user): ResponseInterface
302  {
303  $context = GeneralUtility::makeInstance(Context::class);
305  $user = $this->backendUserRepository->findByUid($user);
306  if (!$user || !$user->isPasswordResetEnabled() || !$context->getAspect('backend.user')->isAdmin()) {
307  // Add an error message
308  $this->‪addFlashMessage(
309  ‪LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang.xlf:flashMessage.resetPassword.error.text', 'beuser') ?? '',
310  ‪LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang.xlf:flashMessage.resetPassword.error.title', 'beuser') ?? '',
311  ContextualFeedbackSeverity::ERROR
312  );
313  } else {
314  GeneralUtility::makeInstance(PasswordReset::class)->initiateReset(
315  $this->request,
316  $context,
317  $user->getEmail()
318  );
319  $this->‪addFlashMessage(
320  ‪LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang.xlf:flashMessage.resetPassword.success.text', 'beuser', [$user->getEmail()]) ?? '',
321  ‪LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang.xlf:flashMessage.resetPassword.success.title', 'beuser') ?? '',
322  ContextualFeedbackSeverity::OK
323  );
324  }
325  return new ‪ForwardResponse('index');
326  }
327 
331  public function ‪addToCompareListAction(int ‪$uid): ResponseInterface
332  {
333  $this->‪addToCompareList('compareUserList', $uid);
334  return new ‪ForwardResponse('index');
335  }
336 
340  public function ‪removeFromCompareListAction(int ‪$uid, int $redirectToCompare = 0): ResponseInterface
341  {
342  $this->‪removeFromCompareList('compareUserList', $uid);
343  if ($redirectToCompare) {
344  return $this->‪redirect('compare');
345  }
346  return $this->‪redirect('index');
347  }
348 
352  public function ‪removeAllFromCompareListAction(): ResponseInterface
353  {
354  $this->‪cleanCompareList('compareUserList');
355  return $this->‪redirect('index');
356  }
357 
362  protected function ‪terminateBackendUserSessionAction(string $sessionId): ResponseInterface
363  {
364  // terminating value of persisted session ID
365  $success = $this->backendUserSessionRepository->terminateSessionByIdentifier($sessionId);
366  if ($success) {
367  $this->‪addFlashMessage(‪LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang.xlf:terminateSessionSuccess', 'beuser') ?? '');
368  }
369  return new ‪ForwardResponse('online');
370  }
371 
375  public function ‪groupsAction(?‪BackendUserGroup $userGroupDto = null, int $currentPage = 1, string $operation = ''): ResponseInterface
376  {
377  $backendUser = $this->‪getBackendUser();
378 
379  if ($operation === 'reset-filters') {
380  $this->moduleData->set('userGroupDto', []);
381  $userGroupDto = null;
382  }
383 
384  if ($userGroupDto === null) {
385  $userGroupDto = ‪BackendUserGroup::fromUc((array)$this->moduleData->get('userGroupDto', []));
386  } else {
387  $this->moduleData->set('userGroupDto', $userGroupDto->forUc());
388  }
389 
390  $backendUser->pushModuleData($this->moduleData->getModuleIdentifier(), $this->moduleData->toArray());
391 
392  $backendUsers = $this->backendUserGroupRepository->findByFilter($userGroupDto);
393  $paginator = new ‪QueryResultPaginator($backendUsers, $currentPage, 50);
394  $pagination = new ‪SimplePagination($paginator);
395  $compareGroupUidList = array_keys((array)$this->moduleData->get('compareGroupUidList', []));
396  $this->moduleTemplate->assignMultiple(
397  [
398  'paginator' => $paginator,
399  'pagination' => $pagination,
400  'totalAmountOfBackendUserGroups' => $backendUsers->count(),
401  'compareGroupUidList' => array_map(static function (int $value): int { // uid as key and force value to 1
402  return 1;
403  }, array_flip($compareGroupUidList)),
404  'compareGroupList' => !empty($compareGroupUidList) ? $this->backendUserGroupRepository->findByUidList($compareGroupUidList) : [],
405  'userGroupDto' => $userGroupDto,
406  ]
407  );
408 
409  $this->‪addMainMenu('groups');
410  $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
411  $addGroupButton = $buttonBar->makeLinkButton()
412  ->setIcon($this->iconFactory->getIcon('actions-plus', IconSize::SMALL))
413  ->setTitle(‪LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang.xlf:backendUserGroup.create', 'beuser'))
414  ->setShowLabelText(true)
415  ->setHref((string)$this->backendUriBuilder->buildUriFromRoute('record_edit', [
416  'edit' => ['be_groups' => [0 => 'new']],
417  'returnUrl' => $this->request->getAttribute('normalizedParams')->getRequestUri(),
418  ]));
419  $buttonBar->addButton($addGroupButton);
420  $shortcutButton = $buttonBar->makeShortcutButton()
421  ->setRouteIdentifier('backend_user_management')
422  ->setArguments(['action' => 'groups'])
423  ->setDisplayName(‪LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang.xlf:backendUserGroupsMenu', 'beuser'));
424  $buttonBar->addButton($shortcutButton, ‪ButtonBar::BUTTON_POSITION_RIGHT);
425 
426  return $this->moduleTemplate->renderResponse('BackendUserGroup/List');
427  }
428 
429  public function ‪compareGroupsAction(): ResponseInterface
430  {
431  $compareGroupUidList = array_keys((array)$this->moduleData->get('compareGroupUidList', []));
432 
433  $compareData = [];
434  foreach ($compareGroupUidList as ‪$uid) {
435  if ($compareInformation = $this->userInformationService->getGroupInformation(‪$uid)) {
436  $compareData[] = $compareInformation;
437  }
438  }
439  if (empty($compareData)) {
440  return $this->‪redirect('groups');
441  }
442 
443  $this->moduleTemplate->assign('compareGroupList', $compareData);
444 
445  $this->‪addMainMenu('compareGroups');
446  $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
447  $backButton = $buttonBar->makeLinkButton()
448  ->setIcon($this->iconFactory->getIcon('actions-view-go-back', IconSize::SMALL))
449  ->setTitle(‪LocalizationUtility::translate('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.goBack'))
450  ->setShowLabelText(true)
451  ->setHref($this->uriBuilder->uriFor('groups'));
452  $buttonBar->addButton($backButton);
453  $shortcutButton = $buttonBar->makeShortcutButton()
454  ->setRouteIdentifier('backend_user_management')
455  ->setArguments(['action' => 'compareGroups'])
456  ->setDisplayName(‪LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang.xlf:compareBackendUsersGroups', 'beuser'));
457  $buttonBar->addButton($shortcutButton, ‪ButtonBar::BUTTON_POSITION_RIGHT);
458 
459  return $this->moduleTemplate->renderResponse('BackendUserGroup/Compare');
460  }
461 
465  public function ‪addGroupToCompareListAction(int ‪$uid): ResponseInterface
466  {
467  $this->‪addToCompareList('compareGroupUidList', $uid);
468  return $this->‪redirect('groups');
469  }
470 
474  public function ‪removeGroupFromCompareListAction(int ‪$uid, int $redirectToCompare = 0): ResponseInterface
475  {
476  $this->‪removeFromCompareList('compareGroupUidList', $uid);
477  if ($redirectToCompare) {
478  return $this->‪redirect('compareGroups');
479  }
480  return $this->‪redirect('groups');
481  }
482 
486  public function ‪removeAllGroupsFromCompareListAction(): ResponseInterface
487  {
488  $this->‪cleanCompareList('compareGroupUidList');
489  return $this->‪redirect('groups');
490  }
491 
492  protected function ‪filemountsAction(int $currentPage = 1): ResponseInterface
493  {
495  $filemounts = $this->fileMountRepository->findAll();
496 
497  $this->‪addMainMenu('filemounts');
498 
499  $paginator = new ‪QueryResultPaginator($filemounts, $currentPage, 50);
500  $pagination = new ‪SimplePagination($paginator);
501  $this->moduleTemplate->assignMultiple(
502  [
503  'paginator' => $paginator,
504  'pagination' => $pagination,
505  'totalAmountOfFilemounts' => $filemounts->count(),
506  ]
507  );
508 
509  $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
510 
511  $addFilemountButton = $buttonBar->makeLinkButton()
512  ->setIcon($this->iconFactory->getIcon('actions-plus', IconSize::SMALL))
513  ->setTitle(‪LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang.xlf:filemount.create', 'beuser'))
514  ->setShowLabelText(true)
515  ->setHref((string)$this->backendUriBuilder->buildUriFromRoute('record_edit', [
516  'edit' => ['sys_filemounts' => [0 => 'new']],
517  'returnUrl' => $this->request->getAttribute('normalizedParams')->getRequestUri(),
518  ]));
519  $buttonBar->addButton($addFilemountButton);
520 
521  return $this->moduleTemplate->renderResponse('Filemount/List');
522  }
523 
531  protected function ‪getOnlineBackendUsers(): array
532  {
533  $onlineUsers = $this->backendUserSessionRepository->findAllActive();
534  $onlineBackendUsers = [];
535  foreach ($onlineUsers as $onlineUser) {
536  $onlineBackendUsers[$onlineUser['ses_userid']] = true;
537  }
538  return $onlineBackendUsers;
539  }
540 
544  protected function ‪addMainMenu(string $currentAction): void
545  {
546  $this->uriBuilder->setRequest($this->request);
547  $menu = $this->moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->makeMenu();
548  $menu->setIdentifier('BackendUserModuleMenu');
549  $menu->addMenuItem(
550  $menu->makeMenuItem()
551  ->setTitle(‪LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang.xlf:backendUsers', 'beuser'))
552  ->setHref($this->uriBuilder->uriFor('index'))
553  ->setActive($currentAction === 'index')
554  );
555  if ($currentAction === 'show') {
556  $menu->addMenuItem(
557  $menu->makeMenuItem()
558  ->setTitle(‪LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang.xlf:backendUserDetails', 'beuser'))
559  ->setHref($this->uriBuilder->uriFor('show'))
560  ->setActive(true)
561  );
562  }
563  if ($currentAction === 'compare') {
564  $menu->addMenuItem(
565  $menu->makeMenuItem()
566  ->setTitle(‪LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang.xlf:compareBackendUsers', 'beuser'))
567  ->setHref($this->uriBuilder->uriFor('index'))
568  ->setActive(true)
569  );
570  }
571  $menu->addMenuItem(
572  $menu->makeMenuItem()
573  ->setTitle(‪LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang.xlf:backendUserGroupsMenu', 'beuser'))
574  ->setHref($this->uriBuilder->uriFor('groups'))
575  ->setActive($currentAction === 'groups')
576  );
577  if ($currentAction === 'compareGroups') {
578  $menu->addMenuItem(
579  $menu->makeMenuItem()
580  ->setTitle(‪LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang.xlf:compareBackendUsersGroups', 'beuser'))
581  ->setHref($this->uriBuilder->uriFor('compareGroups'))
582  ->setActive(true)
583  );
584  }
585  $menu->addMenuItem(
586  $menu->makeMenuItem()
587  ->setTitle(‪LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang.xlf:onlineUsers', 'beuser'))
588  ->setHref($this->uriBuilder->uriFor('online'))
589  ->setActive($currentAction === 'online')
590  );
591  $menu->addMenuItem(
592  $menu->makeMenuItem()
593  ->setTitle(‪LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang.xlf:filemounts', 'beuser'))
594  ->setHref($this->uriBuilder->uriFor('filemounts'))
595  ->setActive($currentAction === 'filemounts')
596  );
597  $this->moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->addMenu($menu);
598  }
599 
603  protected function ‪addToCompareList(string $listIdentifier, int ‪$uid): void
604  {
605  $compareList = (array)$this->moduleData->get($listIdentifier, []);
606  $compareList[‪$uid] = true;
607  $this->moduleData->set($listIdentifier, $compareList);
608  $this->‪getBackendUser()->pushModuleData($this->moduleData->getModuleIdentifier(), $this->moduleData->toArray());
609  }
610 
614  protected function ‪removeFromCompareList(string $listIdentifier, int ‪$uid): void
615  {
616  $compareList = (array)$this->moduleData->get($listIdentifier, []);
617  unset($compareList[‪$uid]);
618  $this->moduleData->set($listIdentifier, $compareList);
619  $this->‪getBackendUser()->pushModuleData($this->moduleData->getModuleIdentifier(), $this->moduleData->toArray());
620  }
621 
625  protected function ‪cleanCompareList(string $listIdentifier): void
626  {
627  $this->moduleData->set($listIdentifier, []);
628  $this->‪getBackendUser()->pushModuleData($this->moduleData->getModuleIdentifier(), $this->moduleData->toArray());
629  }
630 
632  {
633  return ‪$GLOBALS['BE_USER'];
634  }
635 }
‪TYPO3\CMS\Extbase\Mvc\Controller\ActionController\addFlashMessage
‪addFlashMessage(string $messageBody, string $messageTitle='', ContextualFeedbackSeverity $severity=ContextualFeedbackSeverity::OK, bool $storeInSession=true)
Definition: ActionController.php:637
‪TYPO3\CMS\Beuser\Controller\BackendUserController\cleanCompareList
‪cleanCompareList(string $listIdentifier)
Definition: BackendUserController.php:625
‪TYPO3\CMS\Backend\Template\Components\ButtonBar\BUTTON_POSITION_LEFT
‪const BUTTON_POSITION_LEFT
Definition: ButtonBar.php:37
‪TYPO3\CMS\Beuser\Controller\BackendUserController\removeFromCompareList
‪removeFromCompareList(string $listIdentifier, int $uid)
Definition: BackendUserController.php:614
‪TYPO3\CMS\Backend\Template\Components\ButtonBar
Definition: ButtonBar.php:33
‪TYPO3\CMS\Beuser\Controller\BackendUserController\showAction
‪showAction(int $uid=0)
Definition: BackendUserController.php:218
‪TYPO3\CMS\Extbase\Mvc\Controller\ActionController\$request
‪RequestInterface $request
Definition: ActionController.php:110
‪TYPO3\CMS\Extbase\Utility\LocalizationUtility
Definition: LocalizationUtility.php:35
‪TYPO3\CMS\Backend\Template\ModuleTemplateFactory
Definition: ModuleTemplateFactory.php:33
‪TYPO3\CMS\Beuser\Controller\BackendUserController\initiatePasswordResetAction
‪initiatePasswordResetAction(int $user)
Definition: BackendUserController.php:301
‪TYPO3\CMS\Backend\Authentication\PasswordReset
Definition: PasswordReset.php:64
‪TYPO3\CMS\Beuser\Controller\BackendUserController\terminateBackendUserSessionAction
‪terminateBackendUserSessionAction(string $sessionId)
Definition: BackendUserController.php:362
‪TYPO3\CMS\Backend\Module\ModuleData\toArray
‪toArray()
Definition: ModuleData.php:122
‪TYPO3\CMS\Beuser\Controller\BackendUserController\removeFromCompareListAction
‪removeFromCompareListAction(int $uid, int $redirectToCompare=0)
Definition: BackendUserController.php:340
‪TYPO3\CMS\Backend\Module\ModuleData
Definition: ModuleData.php:30
‪TYPO3\CMS\Backend\Module\ModuleData\get
‪get(string $propertyName, mixed $default=null)
Definition: ModuleData.php:56
‪TYPO3\CMS\Beuser\Controller\BackendUserController\addMainMenu
‪addMainMenu(string $currentAction)
Definition: BackendUserController.php:544
‪TYPO3\CMS\Beuser\Controller
Definition: BackendUserController.php:18
‪TYPO3\CMS\Extbase\Pagination\QueryResultPaginator
Definition: QueryResultPaginator.php:24
‪TYPO3\CMS\Beuser\Controller\BackendUserController\compareAction
‪compareAction()
Definition: BackendUserController.php:262
‪TYPO3\CMS\Core\Imaging\IconFactory
Definition: IconFactory.php:34
‪TYPO3\CMS\Extbase\Http\ForwardResponse
Definition: ForwardResponse.php:24
‪TYPO3\CMS\Core\Context\Context
Definition: Context.php:54
‪TYPO3\CMS\Backend\Template\ModuleTemplate
Definition: ModuleTemplate.php:46
‪TYPO3\CMS\Core\Pagination\SimplePagination
Definition: SimplePagination.php:21
‪TYPO3\CMS\Beuser\Controller\BackendUserController\addToCompareListAction
‪addToCompareListAction(int $uid)
Definition: BackendUserController.php:331
‪TYPO3\CMS\Core\Type\ContextualFeedbackSeverity
‪ContextualFeedbackSeverity
Definition: ContextualFeedbackSeverity.php:25
‪TYPO3\CMS\Beuser\Controller\BackendUserController\filemountsAction
‪filemountsAction(int $currentPage=1)
Definition: BackendUserController.php:492
‪TYPO3\CMS\Beuser\Controller\BackendUserController\$moduleData
‪ModuleData $moduleData
Definition: BackendUserController.php:58
‪TYPO3\CMS\Beuser\Controller\BackendUserController\removeGroupFromCompareListAction
‪removeGroupFromCompareListAction(int $uid, int $redirectToCompare=0)
Definition: BackendUserController.php:474
‪TYPO3\CMS\Core\Page\PageRenderer
Definition: PageRenderer.php:44
‪TYPO3\CMS\Beuser\Domain\Repository\FileMountRepository
Definition: FileMountRepository.php:30
‪TYPO3\CMS\Beuser\Domain\Repository\BackendUserSessionRepository
Definition: BackendUserSessionRepository.php:29
‪TYPO3\CMS\Beuser\Controller\BackendUserController\compareGroupsAction
‪compareGroupsAction()
Definition: BackendUserController.php:429
‪TYPO3\CMS\Beuser\Controller\BackendUserController\getBackendUser
‪getBackendUser()
Definition: BackendUserController.php:631
‪TYPO3\CMS\Backend\Routing\UriBuilder
Definition: UriBuilder.php:44
‪TYPO3\CMS\Extbase\Utility\LocalizationUtility\translate
‪static string null translate(string $key, ?string $extensionName=null, array $arguments=null, Locale|string $languageKey=null)
Definition: LocalizationUtility.php:47
‪TYPO3\CMS\Extbase\Mvc\RequestInterface\withControllerActionName
‪withControllerActionName(string $actionName)
‪TYPO3\CMS\Beuser\Controller\BackendUserController\getOnlineBackendUsers
‪getOnlineBackendUsers()
Definition: BackendUserController.php:531
‪TYPO3\CMS\Extbase\Persistence\QueryResultInterface
Definition: QueryResultInterface.php:26
‪TYPO3\CMS\Core\Authentication\BackendUserAuthentication
Definition: BackendUserAuthentication.php:61
‪TYPO3\CMS\Beuser\Domain\Repository\BackendUserRepository
Definition: BackendUserRepository.php:35
‪TYPO3\CMS\Extbase\Mvc\Controller\ActionController\$arguments
‪Arguments $arguments
Definition: ActionController.php:123
‪TYPO3\CMS\Beuser\Controller\BackendUserController\initializeAction
‪initializeAction()
Definition: BackendUserController.php:104
‪TYPO3\CMS\Beuser\Domain\Model\Demand\fromUc
‪static fromUc(array $uc)
Definition: Demand.php:43
‪TYPO3\CMS\Backend\Module\ModuleData\set
‪set(string $propertyName, mixed $value)
Definition: ModuleData.php:66
‪TYPO3\CMS\Beuser\Controller\BackendUserController\__construct
‪__construct(protected readonly BackendUserRepository $backendUserRepository, protected readonly BackendUserGroupRepository $backendUserGroupRepository, protected readonly BackendUserSessionRepository $backendUserSessionRepository, protected readonly UserInformationService $userInformationService, protected readonly ModuleTemplateFactory $moduleTemplateFactory, protected readonly BackendUriBuilder $backendUriBuilder, protected readonly IconFactory $iconFactory, protected readonly PageRenderer $pageRenderer, protected readonly FileMountRepository $fileMountRepository)
Definition: BackendUserController.php:61
‪TYPO3\CMS\Extbase\Mvc\Controller\ActionController\redirect
‪redirect(?string $actionName, ?string $controllerName=null, ?string $extensionName=null, ?array $arguments=null, ?int $pageUid=null, $_=null, int $statusCode=303)
Definition: ActionController.php:688
‪TYPO3\CMS\Beuser\Controller\BackendUserController\$moduleTemplate
‪ModuleTemplate $moduleTemplate
Definition: BackendUserController.php:59
‪TYPO3\CMS\Beuser\Domain\Model\Demand
Definition: Demand.php:25
‪TYPO3\CMS\Extbase\Mvc\RequestInterface
Definition: RequestInterface.php:24
‪TYPO3\CMS\Webhooks\Message\$uid
‪identifier readonly int $uid
Definition: PageModificationMessage.php:35
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Beuser\Controller\BackendUserController\removeAllGroupsFromCompareListAction
‪removeAllGroupsFromCompareListAction()
Definition: BackendUserController.php:486
‪TYPO3\CMS\Extbase\Mvc\Controller\ActionController
Definition: ActionController.php:63
‪TYPO3\CMS\Beuser\Domain\Dto\BackendUserGroup\fromUc
‪static fromUc(array $uc)
Definition: BackendUserGroup.php:27
‪TYPO3\CMS\Beuser\Controller\BackendUserController\groupsAction
‪groupsAction(?BackendUserGroup $userGroupDto=null, int $currentPage=1, string $operation='')
Definition: BackendUserController.php:375
‪TYPO3\CMS\Extbase\Mvc\Controller\ActionController\getFlashMessageQueue
‪getFlashMessageQueue(string $identifier=null)
Definition: ActionController.php:662
‪TYPO3\CMS\Beuser\Controller\BackendUserController\addGroupToCompareListAction
‪addGroupToCompareListAction(int $uid)
Definition: BackendUserController.php:465
‪TYPO3\CMS\Beuser\Controller\BackendUserController\addToCompareList
‪addToCompareList(string $listIdentifier, int $uid)
Definition: BackendUserController.php:603
‪TYPO3\CMS\Beuser\Domain\Repository\BackendUserGroupRepository
Definition: BackendUserGroupRepository.php:34
‪TYPO3\CMS\Beuser\Controller\BackendUserController
Definition: BackendUserController.php:57
‪TYPO3\CMS\Beuser\Domain\Model\BackendUser
Definition: BackendUser.php:32
‪TYPO3\CMS\Beuser\Controller\BackendUserController\removeAllFromCompareListAction
‪removeAllFromCompareListAction()
Definition: BackendUserController.php:352
‪TYPO3\CMS\Beuser\Service\UserInformationService
Definition: UserInformationService.php:33
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:52
‪TYPO3\CMS\Beuser\Controller\BackendUserController\onlineAction
‪onlineAction()
Definition: BackendUserController.php:189
‪TYPO3\CMS\Backend\Template\Components\ButtonBar\BUTTON_POSITION_RIGHT
‪const BUTTON_POSITION_RIGHT
Definition: ButtonBar.php:42
‪TYPO3\CMS\Extbase\Mvc\Request
Definition: Request.php:35
‪TYPO3\CMS\Extbase\Mvc\RequestInterface\getArguments
‪getArguments()
‪TYPO3\CMS\Backend\Module\ModuleData\getModuleIdentifier
‪getModuleIdentifier()
Definition: ModuleData.php:51
‪TYPO3\CMS\Beuser\Controller\BackendUserController\indexAction
‪indexAction(?Demand $demand=null, int $currentPage=1, string $operation='')
Definition: BackendUserController.php:130
‪TYPO3\CMS\Beuser\Controller\BackendUserController\initializeView
‪initializeView()
Definition: BackendUserController.php:115
‪TYPO3\CMS\Backend\Module\ModuleData\has
‪has(string $propertyName)
Definition: ModuleData.php:61
‪TYPO3\CMS\Beuser\Domain\Dto\BackendUserGroup
Definition: BackendUserGroup.php:24
‪TYPO3\CMS\Beuser\Controller\BackendUserController\processRequest
‪processRequest(RequestInterface $request)
Definition: BackendUserController.php:76