[BUGFIX] Use real BE user for logging user setting changes 55/52555/2
authorMarkus Klein <markus.klein@typo3.org>
Fri, 21 Apr 2017 19:14:52 +0000 (21:14 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 21 Apr 2017 21:13:04 +0000 (23:13 +0200)
When editing someone else's user settings as admin the log
should still show the editing user as responsible for the changes.

Resolves: #80947
Releases: master, 8.7, 7.6
Change-Id: I4d57826d65ae34325bea9efdfbd076e47fff0d6d
Reviewed-on: https://review.typo3.org/52555
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/setup/Classes/Controller/SetupModuleController.php

index daea46c..968c3e0 100644 (file)
@@ -295,9 +295,10 @@ class SetupModuleController extends AbstractModule
                 $dataHandler = GeneralUtility::makeInstance(DataHandler::class);
                 $dataHandler->stripslashes_values = false;
                 // This is so the user can actually update his user record.
-                $isAdmin = $beUser->user['admin'];
-                $beUser->user['admin'] = 1;
-                $dataHandler->start($storeRec, [], $beUser);
+                $realUser = $this->getRealScriptUserObj();
+                $isAdmin = $realUser->user['admin'];
+                $realUser->user['admin'] = 1;
+                $dataHandler->start($storeRec, [], $realUser);
                 // This is to make sure that the users record can be updated even if in another workspace. This is tolerated.
                 $dataHandler->bypassWorkspaceRestrictions = true;
                 $dataHandler->process_datamap();
@@ -306,7 +307,7 @@ class SetupModuleController extends AbstractModule
                     $this->setupIsUpdated = true;
                 }
                 // Restore admin status after processing
-                $beUser->user['admin'] = $isAdmin;
+                $realUser->user['admin'] = $isAdmin;
             }
         }
     }