From 14a1494407a1d8207daf46650c91f0facbf66d0e Mon Sep 17 00:00:00 2001
From: Benjamin Kott <benjamin.kott@outlook.com>
Date: Thu, 29 Feb 2024 11:52:21 +0100
Subject: [PATCH] [TASK] Show backend user groups in backend users list view
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

If you are managing backend users, it is now also possible to view
the assigned groups directly. The hardcoded edit labels are now
also replaced with the respecting translatable variants.

Resolves: #103231
Releases: main
Change-Id: Icbf16f420689b288d5f334c94872b71112ac83f0
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/83162
Reviewed-by: Frank Nägler <frank.naegler@typo3.com>
Tested-by: Oliver Bartsch <bo@cedev.de>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
Reviewed-by: Benjamin Kott <benjamin.kott@outlook.com>
Tested-by: Frank Nägler <frank.naegler@typo3.com>
Tested-by: core-ci <typo3@b13.com>
Tested-by: Benjamin Kott <benjamin.kott@outlook.com>
---
 .../Private/Partials/BackendUser/PaginatedList.html    | 10 ++++++++--
 .../Partials/BackendUserGroup/PaginatedList.html       |  9 +++------
 .../Private/Templates/BackendUser/Compare.html         |  2 +-
 .../Resources/Private/Templates/BackendUser/List.html  |  4 ++--
 .../Application/BackendUser/CompareUserCest.php        |  4 ++--
 5 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/PaginatedList.html b/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/PaginatedList.html
index 38c0743709f6..f46f056c58fb 100644
--- a/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/PaginatedList.html
+++ b/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/PaginatedList.html
@@ -11,6 +11,7 @@
         <thead>
         <tr>
             <th colspan="2"><f:translate key="userName" /> / <f:translate key="realName" /></th>
+            <th><f:translate key="backendUserGroup" /></th>
             <th><f:translate key="lastLogin" /></th>
             <th class="col-control"></th>
         </tr>
@@ -30,7 +31,7 @@
                         </a>
                     </td>
                     <td class="col-title">
-                        <backend:link.editRecord table="be_users" uid="{backendUser.uid}" title="edit">
+                        <backend:link.editRecord table="be_users" uid="{backendUser.uid}" title="{f:translate(key:'edit')}">
                             <b>{backendUser.userName}</b>
                         </backend:link.editRecord>
                         <f:if condition="{onlineBackendUsers.{backendUser.uid}}">
@@ -39,11 +40,16 @@
                         <beuser:mfaStatus userUid="{backendUser.uid}"/>
                         <br>
                         <f:if condition="{backendUser.realName}">
-                            <backend:link.editRecord table="be_users" uid="{backendUser.uid}" title="edit">
+                            <backend:link.editRecord table="be_users" uid="{backendUser.uid}" title="{f:translate(key:'edit')}">
                                 {backendUser.realName}
                             </backend:link.editRecord>
                         </f:if>
                     </td>
+                    <td class="nowrap-disabled">
+                        <f:for each="{backendUser.backendUserGroups}" as="backendUserGroup" iteration="backendUserGroupIterator">
+                            <backend:link.editRecord table="be_groups" uid="{backendUserGroup.uid}" title="{f:translate(key:'edit')}" class="nowrap">{backendUserGroup.title}</backend:link.editRecord><f:if condition="!{backendUserGroupIterator.isLast}">,</f:if>
+                        </f:for>
+                    </td>
                     <td class="col-datetime">
                         <f:if condition="{backendUser.lastLoginDateAndTime}">
                             <f:then>
diff --git a/typo3/sysext/beuser/Resources/Private/Partials/BackendUserGroup/PaginatedList.html b/typo3/sysext/beuser/Resources/Private/Partials/BackendUserGroup/PaginatedList.html
index ab80d82f7036..be96a40452ff 100644
--- a/typo3/sysext/beuser/Resources/Private/Partials/BackendUserGroup/PaginatedList.html
+++ b/typo3/sysext/beuser/Resources/Private/Partials/BackendUserGroup/PaginatedList.html
@@ -30,22 +30,19 @@
                         </a>
                     </td>
                     <td class="title">
-                        <backend:link.editRecord table="be_groups" uid="{backendUserGroup.uid}" title="edit">
+                        <backend:link.editRecord table="be_groups" uid="{backendUserGroup.uid}" title="{f:translate(key:'edit')}">
                             <b>{backendUserGroup.title}</b><br>
                             {backendUser.realName}
                         </backend:link.editRecord>
                     </td>
                     <td class="nowrap-disabled">
                         <f:for each="{backendUserGroup.subgroups}" as="subgroup" iteration="subGroupIterator">
-                            <backend:link.editRecord table="be_groups" uid="{subgroup.uid}" title="edit">
-                                {subgroup.title}
-                            </backend:link.editRecord>
-                            <f:if condition="!{subGroupIterator.isLast}">, </f:if>
+                            <backend:link.editRecord table="be_groups" uid="{subgroup.uid}" title="{f:translate(key:'edit')}">{subgroup.title}</backend:link.editRecord><f:if condition="!{subGroupIterator.isLast}">,</f:if>
                         </f:for>
                     </td>
                     <td class="col-control">
                         <div class="btn-group" role="group">
-                            <backend:link.editRecord class="btn btn-default" table="be_groups" uid="{backendUserGroup.uid}" title="edit">
+                            <backend:link.editRecord class="btn btn-default" table="be_groups" uid="{backendUserGroup.uid}" title="{f:translate(key:'edit')}">
                                 <core:icon identifier="actions-open" />
                             </backend:link.editRecord>
                             <f:if condition="{backendUserGroup.hidden}">
diff --git a/typo3/sysext/beuser/Resources/Private/Templates/BackendUser/Compare.html b/typo3/sysext/beuser/Resources/Private/Templates/BackendUser/Compare.html
index 140bc1287c40..b7bde5fc1ead 100644
--- a/typo3/sysext/beuser/Resources/Private/Templates/BackendUser/Compare.html
+++ b/typo3/sysext/beuser/Resources/Private/Templates/BackendUser/Compare.html
@@ -24,7 +24,7 @@
                                     <f:link.action action="removeFromCompareList" arguments="{uid: compareData.user.uid, redirectToCompare:1}" class="btn btn-default">
                                         <core:icon identifier="actions-minus" size="small"/>
                                     </f:link.action>
-                                    <backend:link.editRecord class="btn btn-default" table="be_users" uid="{compareData.user.uid}" title="edit">
+                                    <backend:link.editRecord class="btn btn-default" table="be_users" uid="{compareData.user.uid}" title="{f:translate(key:'edit')}">
                                         <core:icon identifier="actions-open" />
                                     </backend:link.editRecord>
                                 </div>
diff --git a/typo3/sysext/beuser/Resources/Private/Templates/BackendUser/List.html b/typo3/sysext/beuser/Resources/Private/Templates/BackendUser/List.html
index 1a4b083ae2c2..a8c3a652c8d1 100644
--- a/typo3/sysext/beuser/Resources/Private/Templates/BackendUser/List.html
+++ b/typo3/sysext/beuser/Resources/Private/Templates/BackendUser/List.html
@@ -29,7 +29,7 @@
                                 </a>
                             </td>
                             <td class="col-title">
-                                <backend:link.editRecord table="be_users" uid="{compareUser.uid}" title="edit">
+                                <backend:link.editRecord table="be_users" uid="{compareUser.uid}" title="{f:translate(key:'edit')}">
                                     <b>{compareUser.username}</b>
                                 </backend:link.editRecord>
                                 <f:if condition="{onlineBackendUsers.{compareUser.uid}}">
@@ -37,7 +37,7 @@
                                 </f:if>
                                 <br>
                                 <f:if condition="{compareUser.realName}">
-                                    <backend:link.editRecord table="be_users" uid="{compareUser.uid}" title="edit">
+                                    <backend:link.editRecord table="be_users" uid="{compareUser.uid}" title="{f:translate(key:'edit')}">
                                         {compareUser.realName}
                                     </backend:link.editRecord>
                                 </f:if>
diff --git a/typo3/sysext/core/Tests/Acceptance/Application/BackendUser/CompareUserCest.php b/typo3/sysext/core/Tests/Acceptance/Application/BackendUser/CompareUserCest.php
index 2d83ea809931..41f18419d491 100644
--- a/typo3/sysext/core/Tests/Acceptance/Application/BackendUser/CompareUserCest.php
+++ b/typo3/sysext/core/Tests/Acceptance/Application/BackendUser/CompareUserCest.php
@@ -47,7 +47,7 @@ final class CompareUserCest
 
         // first user can be edited
         $usernameFirstCompare = $I->grabTextFrom('#tx_beuser_compare > thead > tr > th:nth-child(2) > div > div > span');
-        $I->click('#tx_beuser_compare > thead > tr > th:nth-child(2) a[title="edit"]');
+        $I->click('#tx_beuser_compare > thead > tr > th:nth-child(2) a[title="Edit"]');
         $I->waitForElementNotVisible('#t3js-ui-block');
         $I->waitForElementVisible('#EditDocumentController');
         $I->canSee('Edit Backend user "' . $usernameFirstCompare . '" on root level');
@@ -59,7 +59,7 @@ final class CompareUserCest
 
         // second user can be edited
         $usernameFirstCompare = $I->grabTextFrom('#tx_beuser_compare > thead > tr > th:nth-child(3) > div > div > span');
-        $I->click('#tx_beuser_compare > thead > tr > th:nth-child(3) a[title="edit"]');
+        $I->click('#tx_beuser_compare > thead > tr > th:nth-child(3) a[title="Edit"]');
         $I->waitForElementNotVisible('#t3js-ui-block');
         $I->waitForElementVisible('#EditDocumentController');
         $I->canSee('Edit Backend user "' . $usernameFirstCompare . '" on root level');
-- 
GitLab