diff --git a/typo3/sysext/beuser/Classes/Controller/BackendUserController.php b/typo3/sysext/beuser/Classes/Controller/BackendUserController.php index 1e3a237fb8080617c90747064eaa951f672938aa..b3e342536fa891c17e6bfcc4086fb84bf63a1822 100644 --- a/typo3/sysext/beuser/Classes/Controller/BackendUserController.php +++ b/typo3/sysext/beuser/Classes/Controller/BackendUserController.php @@ -166,6 +166,7 @@ class BackendUserController extends BackendUserActionController $this->view->assign('compareUserUidList', array_map(function ($item) { return true; }, array_flip((array)$compareUserList))); + $this->view->assign('currentUserUid', $this->getBackendUserAuthentication()->user['uid']); $this->view->assign('compareUserList', !empty($compareUserList) ? $this->backendUserRepository->findByUidList($compareUserList) : ''); } diff --git a/typo3/sysext/beuser/Classes/ViewHelpers/RemoveUserViewHelper.php b/typo3/sysext/beuser/Classes/ViewHelpers/RemoveUserViewHelper.php index 13370652b7b7f204e3bf95909cf8dbe3f205611e..254d030a595e4386ab375ab538e098657c9bd10f 100644 --- a/typo3/sysext/beuser/Classes/ViewHelpers/RemoveUserViewHelper.php +++ b/typo3/sysext/beuser/Classes/ViewHelpers/RemoveUserViewHelper.php @@ -16,17 +16,13 @@ namespace TYPO3\CMS\Beuser\ViewHelpers; use TYPO3\CMS\Backend\Routing\UriBuilder; use TYPO3\CMS\Beuser\Domain\Model\BackendUser; -use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; -use TYPO3\CMS\Core\Imaging\Icon; -use TYPO3\CMS\Core\Imaging\IconFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Extbase\Utility\LocalizationUtility; use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface; use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic; /** - * Displays 'Delete user' link with sprite icon to remove user + * Renders 'Delete user' link * * @internal */ @@ -34,13 +30,6 @@ class RemoveUserViewHelper extends AbstractViewHelper { use CompileWithRenderStatic; - /** - * As this ViewHelper renders HTML, the output must not be escaped. - * - * @var bool - */ - protected $escapeOutput = false; - /** * Initializes the arguments */ @@ -50,7 +39,7 @@ class RemoveUserViewHelper extends AbstractViewHelper } /** - * Render link with sprite icon to remove user + * Renders the URL to remove a user. * * @param array $arguments * @param \Closure $renderChildrenClosure @@ -60,29 +49,11 @@ class RemoveUserViewHelper extends AbstractViewHelper */ public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) { - /** @var \TYPO3\CMS\Beuser\Domain\Model\BackendUser $backendUser */ - $backendUser = $arguments['backendUser']; - /** @var BackendUserAuthentication $beUser */ - $beUser = $GLOBALS['BE_USER']; - /** @var IconFactory $iconFactory */ - $iconFactory = GeneralUtility::makeInstance(IconFactory::class); - if ($backendUser->getUid() === (int)$beUser->user['uid']) { - return '<span class="btn btn-default disabled">' . $iconFactory->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>'; - } - $urlParameters = [ - 'cmd[be_users][' . $backendUser->getUid() . '][delete]' => 1, + 'cmd[be_users][' . $arguments['backendUser']->getUid() . '][delete]' => 1, 'redirect' => GeneralUtility::getIndpEnv('REQUEST_URI') ]; $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); - $url = (string)$uriBuilder->buildUriFromRoute('tce_db', $urlParameters); - - return '<a class="btn btn-default t3js-modal-trigger" href="' . htmlspecialchars($url) . '"' - . ' title="' . htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:beuser/Resources/Private/Language/locallang.xlf:delete')) . '"' - . ' data-severity="warning"' - . ' data-title="' . htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_alt_doc.xlf:label.confirm.delete_record.title')) . '"' - . ' data-content="' . htmlspecialchars(LocalizationUtility::translate('confirm', 'beuser', [$backendUser->getUserName()])) . '" ' - . ' data-button-close-text="' . htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_common.xlf:cancel')) . '"' - . '>' . $iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render() . '</a>'; + return (string)$uriBuilder->buildUriFromRoute('tce_db', $urlParameters); } } diff --git a/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/IndexListRow.html b/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/IndexListRow.html index a33f43be5dc1dd356adec24ae0ed82dd371b4fa1..fec20abc765561940fb5b1df5473adf20c597e38 100644 --- a/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/IndexListRow.html +++ b/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/IndexListRow.html @@ -45,7 +45,21 @@ </f:if> </f:else> </f:if> - <bu:removeUser backendUser="{backendUser}" /> + <f:if condition="{currentUserUid} == {backendUser.uid}"> + <f:then> + <span class="btn btn-default disabled"><core:icon identifier="empty-empty" /></span> + </f:then> + <f:else> + <a class="btn btn-default t3js-modal-trigger" href="{bu:removeUser(backendUser:backendUser)}" + title="{f:translate(key:'LLL:EXT:beuser/Resources/Private/Language/locallang.xlf:delete')}" + data-severity="warning" + data-title="{f:translate(key:'LLL:EXT:lang/Resources/Private/Language/locallang_alt_doc.xlf:label.confirm.delete_record.title')}" + data-content="{f:translate(key:'confirm',arguments:'{0:backendUser.userName}')}" + data-button-close-text="{f:translate(key:'LLL:EXT:lang/Resources/Private/Language/locallang_common.xlf:cancel')}"> + <core:icon identifier="actions-edit-delete" /> + </a> + </f:else> + </f:if> </div> <div class="btn-group" role="group"> <a class="btn btn-default" href="#" onclick="top.TYPO3.InfoWindow.showItem('be_users', '{backendUser.uid}'); return false;"><core:icon identifier="actions-document-info" /></a> diff --git a/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/PaginatedListWidget.html b/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/PaginatedListWidget.html index 598ecaa782e87fbb9b1640bf5e8c647fc7b7e012..a5f11ea5b938487a0098e5768091d4c7f90faf8f 100644 --- a/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/PaginatedListWidget.html +++ b/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/PaginatedListWidget.html @@ -1,3 +1,3 @@ <f:be.widget.paginate objects="{backendUsers}" as="paginatedBackendUsers" configuration="{itemsPerPage: 50, insertBelow: 1}"> <f:render partial="BackendUser/PaginatedListWidgetBody" arguments="{_all}" /> -</f:be.widget.paginate> \ No newline at end of file +</f:be.widget.paginate> diff --git a/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/PaginatedListWidgetBody.html b/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/PaginatedListWidgetBody.html index e16b5d97b30a9b390eb6c28d6cdc478cebd28fd4..d1d812f6bd6164162244c9c01616f76555bc30cc 100644 --- a/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/PaginatedListWidgetBody.html +++ b/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/PaginatedListWidgetBody.html @@ -10,7 +10,7 @@ </thead> <tbody> <f:for each="{paginatedBackendUsers}" as="backendUser"> - <f:render partial="BackendUser/IndexListRow" arguments="{demand: demand, backendUser: backendUser, onlineBackendUsers: onlineBackendUsers, dateFormat: dateFormat, timeFormat: timeFormat, returnUrl: returnUrl, compareUserUidList: compareUserUidList}" /> + <f:render partial="BackendUser/IndexListRow" arguments="{demand: demand, backendUser: backendUser, onlineBackendUsers: onlineBackendUsers, dateFormat: dateFormat, timeFormat: timeFormat, returnUrl: returnUrl, compareUserUidList: compareUserUidList, currentUserUid: currentUserUid}" /> </f:for> <f:comment> Footer row: no officially defined style yet @@ -24,4 +24,4 @@ </tr> </tfoot> </table> -</div> \ No newline at end of file +</div> diff --git a/typo3/sysext/beuser/Resources/Private/Partials/BackendUserGroup/PaginatedListWidgetBody.html b/typo3/sysext/beuser/Resources/Private/Partials/BackendUserGroup/PaginatedListWidgetBody.html index 2982a438ee64887969304a9b9c97ed08310716e1..476d660da57c7b7fd6300d8910b3c3bdc7bafbbc 100644 --- a/typo3/sysext/beuser/Resources/Private/Partials/BackendUserGroup/PaginatedListWidgetBody.html +++ b/typo3/sysext/beuser/Resources/Private/Partials/BackendUserGroup/PaginatedListWidgetBody.html @@ -10,7 +10,7 @@ </thead> <tbody> <f:for each="{paginatedBackendUserGroups}" as="backendUserGroup"> - <f:render partial="BackendUserGroup/IndexListRow" arguments="{demand: demand, backendUserGroup: backendUserGroup, dateFormat: dateFormat, timeFormat: timeFormat, returnUrl: returnUrl}" /> + <f:render partial="BackendUserGroup/IndexListRow" arguments="{demand: demand, backendUserGroup: backendUserGroup, dateFormat: dateFormat, timeFormat: timeFormat, returnUrl: returnUrl, currentUserUid: currentUserUid}" /> </f:for> <f:comment> Footer row: no officially defined style yet @@ -22,4 +22,4 @@ </tr> </tbody> </table> -</div> \ No newline at end of file +</div> diff --git a/typo3/sysext/beuser/Resources/Private/Templates/BackendUser/Index.html b/typo3/sysext/beuser/Resources/Private/Templates/BackendUser/Index.html index 279f2e881ac2b248c5d43daa3e4c8f49f7826146..6adad084c113dbe33ecb06ebbccadb7f393f241f 100644 --- a/typo3/sysext/beuser/Resources/Private/Templates/BackendUser/Index.html +++ b/typo3/sysext/beuser/Resources/Private/Templates/BackendUser/Index.html @@ -8,7 +8,6 @@ </f:section> <f:section name="content"> - <f:comment> Listing of users on compare list </f:comment>