[FEATURE] Add log message for "Switch User action" 24/60824/4
authorc.essl <indy.essl@gmail.com>
Sat, 25 May 2019 11:26:53 +0000 (13:26 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Wed, 5 Jun 2019 20:00:42 +0000 (22:00 +0200)
If an admin user switches to another be_user account via the "Switch User"
action in the "Backend users" module, the action is now logged to the
sys_log.

Resolves: #78432
Releases: master
Change-Id: I0a9cb35e2d8734eb86ff475afeeac821a2f2a78a
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60824
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Guido Schmechel <guido.schmechel@brandung.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Guido Schmechel <guido.schmechel@brandung.de>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/beuser/Classes/Controller/BackendUserController.php
typo3/sysext/core/Documentation/Changelog/master/Feature-78432-AddLogMessageForSwitchUserAction.rst [new file with mode: 0644]

index 3fc18c2..fc7a32e 100644 (file)
@@ -256,6 +256,20 @@ class BackendUserController extends ActionController
             $this->getBackendUserAuthentication()->uc['recentSwitchedToUsers'] = $this->generateListOfMostRecentSwitchedUsers($targetUser['uid']);
             $this->getBackendUserAuthentication()->writeUC();
 
+            // User switch   written to log
+            $this->getBackendUserAuthentication()->writelog(
+                255,
+                2,
+                0,
+                1,
+                'User %s switched to user %s (be_users:%s)',
+                [
+                    $this->getBackendUserAuthentication()->user['username'],
+                    $targetUser['username'],
+                    $targetUser['uid'],
+                ]
+            );
+
             $sessionBackend = $this->getSessionBackend();
             $sessionBackend->update(
                 $this->getBackendUserAuthentication()->getSessionId(),
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-78432-AddLogMessageForSwitchUserAction.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-78432-AddLogMessageForSwitchUserAction.rst
new file mode 100644 (file)
index 0000000..69d94c5
--- /dev/null
@@ -0,0 +1,16 @@
+.. include:: ../../Includes.txt
+
+==========================================================
+Feature: #78432 - Add log message for "Switch User action"
+==========================================================
+
+See :issue:`78432`
+
+Description
+===========
+
+If an admin user switches to another be_user account via the "Switch User" action in the "Backend users" module, the action is now logged to the sys_log.
+
+`User admin switched to user editor (be_users:2)`
+
+.. index:: Backend, ext:beuser
\ No newline at end of file