Commit 0bbf489f authored by Daniel Goerz's avatar Daniel Goerz Committed by Andreas Fernandez
Browse files

[BUGFIX] Restore enable/disable functionality in beuser compare

This patch restores the possibility to enable backend users in
the compare view again. It also reinstalls the check for online
users to prevent disabling a currently logged in user.

Resolves: #90488
Relates: #90298
Releases: master
Change-Id: I0919403a41de136c7461e0d9367b3795bbf68358
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63371


Tested-by: Susanne Moog's avatarSusanne Moog <look@susi.dev>
Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Susanne Moog's avatarSusanne Moog <look@susi.dev>
Reviewed-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
parent ca22b7e4
......@@ -138,17 +138,8 @@ class BackendUserController extends ActionController
}
$compareUserList = $this->moduleData->getCompareUserList();
// Create online user list for easy parsing
$onlineUsers = $this->backendUserSessionRepository->findAllActive();
$onlineBackendUsers = [];
if (is_array($onlineUsers)) {
foreach ($onlineUsers as $onlineUser) {
$onlineBackendUsers[$onlineUser['ses_userid']] = true;
}
}
$this->view->assignMultiple([
'onlineBackendUsers' => $onlineBackendUsers,
'onlineBackendUsers' => $this->getOnlineBackendUsers(),
'demand' => $demand,
'backendUsers' => $this->backendUserRepository->findDemanded($demand),
'backendUserGroups' => array_merge([''], $this->backendUserGroupRepository->findAll()->toArray()),
......@@ -208,7 +199,8 @@ class BackendUserController extends ActionController
$this->view->assignMultiple([
'shortcutLabel' => 'compareUsers',
'compareUserList' => $compareData
'compareUserList' => $compareData,
'onlineBackendUsers' => $this->getOnlineBackendUsers()
]);
}
......@@ -346,4 +338,24 @@ class BackendUserController extends ActionController
$loginType = $this->getBackendUserAuthentication()->getLoginType();
return GeneralUtility::makeInstance(SessionManager::class)->getSessionBackend($loginType);
}
/**
* Create an array with the uids of online users as the keys
* [
* 1 => true,
* 5 => true
* ]
* @return array
*/
protected function getOnlineBackendUsers(): array
{
$onlineUsers = $this->backendUserSessionRepository->findAllActive();
$onlineBackendUsers = [];
if (is_array($onlineUsers)) {
foreach ($onlineUsers as $onlineUser) {
$onlineBackendUsers[$onlineUser['ses_userid']] = true;
}
}
return $onlineBackendUsers;
}
}
......@@ -14,7 +14,7 @@
<be:link.editRecord table="be_users" uid="{backendUser.uid}" title="edit">
<b>{backendUser.userName}</b>
</be:link.editRecord>
<f:if condition="{bu:arrayElement(array: onlineBackendUsers, key: backendUser.uid)}">
<f:if condition="{onlineBackendUsers.{backendUser.uid}}">
<span class="label label-success"><f:translate key="online" /></span>
</f:if>
<br />
......
......@@ -57,16 +57,20 @@
<th><f:translate key="disable_compare" /></th>
<f:for each="{compareUserList}" as="compareUser">
<td>
<f:if condition="{compareUser.disable}">
<f:then>
<a class="btn btn-default" href="{be:moduleLink(route:'tce_db', query:'data[be_users][{compareUser.user.uid}][disable]=0', currentUrlParameterName:'redirect')}" title="{f:translate(key: 'visibility.unhide')}">
<core:icon identifier="actions-edit-unhide" />
</a>
</f:then>
<f:if condition="{onlineBackendUsers.{compareUser.user.uid}}">
<f:else>
<a class="btn btn-default" href="{be:moduleLink(route:'tce_db', query:'data[be_users][{compareUser.user.uid}][disable]=1', currentUrlParameterName:'redirect')}" title="{f:translate(key: 'visibility.hide')}">
<core:icon identifier="actions-edit-hide" />
</a>
<f:if condition="{compareUser.user.disable}">
<f:then>
<a class="btn btn-default" href="{be:moduleLink(route:'tce_db', query:'data[be_users][{compareUser.user.uid}][disable]=0', currentUrlParameterName:'redirect')}" title="{f:translate(key: 'visibility.unhide')}">
<core:icon identifier="actions-edit-unhide" />
</a>
</f:then>
<f:else>
<a class="btn btn-default" href="{be:moduleLink(route:'tce_db', query:'data[be_users][{compareUser.user.uid}][disable]=1', currentUrlParameterName:'redirect')}" title="{f:translate(key: 'visibility.hide')}">
<core:icon identifier="actions-edit-hide" />
</a>
</f:else>
</f:if>
</f:else>
</f:if>
</td>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment