Skip to content

Commit

Permalink
[BUGFIX] Error 503 if non-admin user uses "go back" button in Backend…
Browse files Browse the repository at this point in the history
…UserController->showAction

Use "javascript:history.back()" instead of actual link
to return to the previous page instead switching to
the "system_BeuserTxBeuser" route.

Related: koninklijke-collective#69
  • Loading branch information
mz-aimcom authored Oct 14, 2022
1 parent 5c7ad3c commit c2815d6
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions Classes/Controller/BackendUserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}

0 comments on commit c2815d6

Please sign in to comment.