From c2815d61c4633827ad6d5a6f9a4bf3c2f27fe7e7 Mon Sep 17 00:00:00 2001 From: Markus Date: Fri, 14 Oct 2022 10:39:11 +0200 Subject: [PATCH] [BUGFIX] Error 503 if non-admin user uses "go back" button in BackendUserController->showAction Use "javascript:history.back()" instead of actual link to return to the previous page instead switching to the "system_BeuserTxBeuser" route. Related: #69 --- Classes/Controller/BackendUserController.php | 48 ++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/Classes/Controller/BackendUserController.php b/Classes/Controller/BackendUserController.php index d5619fa..0d5c55c 100644 --- a/Classes/Controller/BackendUserController.php +++ b/Classes/Controller/BackendUserController.php @@ -183,4 +183,52 @@ public function groupsAction(int $currentPage = 1): ResponseInterface return $this->htmlResponse($this->moduleTemplate->renderContent()); } + + /** + * Displays a BackendUser + * + * @param int $uid + * @return ResponseInterface + */ + public function showAction(int $uid = 0): ResponseInterface + { + $data = $this->userInformationService->getUserInformation($uid); + $this->view->assign('data', $data); + + $this->addMainMenu('show'); + $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar(); + $backButton = $buttonBar->makeLinkButton() + ->setIcon($this->iconFactory->getIcon('actions-view-go-back', Icon::SIZE_SMALL)) + ->setTitle(LocalizationUtility::translate('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.goBack')) + ->setHref('javascript:history.back()'); + $buttonBar->addButton($backButton); + $editButton = $buttonBar->makeLinkButton() + ->setIcon($this->iconFactory->getIcon('actions-open', Icon::SIZE_SMALL)) + ->setTitle(LocalizationUtility::translate('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.edit')) + ->setShowLabelText(true) + ->setHref((string)$this->backendUriBuilder->buildUriFromRoute('record_edit', [ + 'edit' => ['be_users' => [$uid => 'edit']], + 'returnUrl' => $this->request->getAttribute('normalizedParams')->getRequestUri(), + ])); + $buttonBar->addButton($editButton); + $addUserButton = $buttonBar->makeLinkButton() + ->setIcon($this->iconFactory->getIcon('actions-add', Icon::SIZE_SMALL)) + ->setTitle(LocalizationUtility::translate('LLL:EXT:backend/Resources/Private/Language/locallang_layout.xlf:newRecordGeneral')) + ->setShowLabelText(true) + ->setHref((string)$this->backendUriBuilder->buildUriFromRoute('record_edit', [ + 'edit' => ['be_users' => [0 => 'new']], + 'returnUrl' => $this->request->getAttribute('normalizedParams')->getRequestUri(), + ])); + $buttonBar->addButton($addUserButton); + $username = empty($data['user']['username']) ? '' : ': ' . $data['user']['username']; + $shortcutButton = $buttonBar->makeShortcutButton() + ->setRouteIdentifier('system_BeuserTxBeuser') + ->setArguments(['action' => 'show', 'uid' => $uid]) + ->setDisplayName(LocalizationUtility::translate('backendUser', 'beuser') . $username); + $buttonBar->addButton($shortcutButton, ButtonBar::BUTTON_POSITION_RIGHT); + + $this->moduleTemplate->setContent($this->view->render()); + + return $this->htmlResponse($this->moduleTemplate->renderContent()); + } }