[TASK] Improve Switch-User concept in ext:beuser
authorGeorg Ringer <georg.ringer@gmail.com>
Mon, 29 Oct 2012 22:41:32 +0000 (23:41 +0100)
committerHelmut Hummel <helmut.hummel@typo3.org>
Mon, 29 Oct 2012 22:55:41 +0000 (23:55 +0100)
The "Switch-User" functionality can be improved:
* It should be possible to switch to other admin user,
  just not the current user
* The title of the link is reintroduced
* The order is as in previous TYPO3 version,
  switch-back-mode is the 2nd one

Resolves: #42502
Releases: 6.0

Change-Id: I7d2a32d5682731798a0671715b2bbfac9a6eee77
Reviewed-on: http://review.typo3.org/16024
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
typo3/sysext/beuser/Classes/ViewHelpers/SUViewHelper.php
typo3/sysext/beuser/Resources/Private/Language/locallang.xlf
typo3/sysext/beuser/Resources/Private/Partials/BackendUser/IndexListRow.html

index f91295f..ae915bd 100755 (executable)
@@ -40,10 +40,10 @@ class SuViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper {
         * @return string
         */
        public function render(\TYPO3\CMS\Beuser\Domain\Model\BackendUser $backendUser, $emulate = FALSE) {
-               if ($backendUser->getIsAdministrator()) {
+               if ($backendUser->getUid() == $GLOBALS['BE_USER']->user['uid']) {
                        return '';
                }
-               $title = $GLOBALS['LANG']->getLL('switchUserTo', TRUE) . ' ' . $backendUser->getUserName() . ' ' . $GLOBALS['LANG']->getLL('switchBackMode', TRUE);
+               $title = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate(($emulate ? 'switchBackMode' : 'changeToMode'), 'beuser');
                return '<a href="' . \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('SwitchUser' => $backendUser->getUid(), 'switchBackUser' => $emulate)) . '" target="_top" title="' . htmlspecialchars($title) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon(('actions-system-backend-user-' . ($emulate ? 'emulate' : 'switch'))) . '</a>';
        }
 
index 32f3865..5c484dd 100644 (file)
                        <trans-unit id="backendUserGroups" xml:space="preserve">
                                <source>Member of groups</source>
                        </trans-unit>
+                       <trans-unit id="changeToMode" xml:space="preserve">
+                               <source>[change-to mode]</source>
+                       </trans-unit>
+                       <trans-unit id="switchBackMode" xml:space="preserve">
+                               <source>[switch-back mode]</source>
+                       </trans-unit>
                </body>
        </file>
 </xliff>
\ No newline at end of file
index febbbc0..1f04b15 100755 (executable)
@@ -44,8 +44,8 @@
                        Only admin users may use the backend user administration.
                </f:comment>
                <f:if condition="{backendUser.active} == 1">
-                       <bu:SU backendUser="{backendUser}" emulate="TRUE" />
                        <bu:SU backendUser="{backendUser}" emulate="FALSE" />
+                       <bu:SU backendUser="{backendUser}" emulate="TRUE" />
                </f:if>
        </td>
        <td>