[BUGFIX] Make sure excludedTablesAndFields are empty in DataHandler 84/38684/5
authorBenjamin Serfhos <serfhos@gmail.com>
Tue, 14 Apr 2015 07:56:14 +0000 (09:56 +0200)
committerMarkus Klein <klein.t3@reelworx.at>
Tue, 28 Apr 2015 22:09:45 +0000 (00:09 +0200)
Simulating the admin function when saving their own account failed when
TCA is modified. The backend user is now simulated as admin, instead of
the DataHandler class only.

Now it validates all possible checks when updating the user records as
admin.

Note: This will keep the same functionality and therefor has no impact
on the Core itself.

Releases: master, 6.2
Resolves: #66412
Change-Id: Ib17ac99d9e7a4aaf1e807b41b30f7310ad8da655
Reviewed-on: http://review.typo3.org/38684
Reviewed-by: Benjamin Serfhos <serfhos@gmail.com>
Tested-by: Benjamin Serfhos <serfhos@gmail.com>
Reviewed-by: Jesper Paardekooper <jesper.paardekooper@gmail.com>
Tested-by: Jesper Paardekooper <jesper.paardekooper@gmail.com>
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
typo3/sysext/setup/Classes/Controller/SetupModuleController.php

index c73d43d..684ad68 100644 (file)
@@ -269,9 +269,10 @@ class SetupModuleController {
                                // Make instance of TCE for storing the changes.
                                $tce = GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class);
                                $tce->stripslashes_values = 0;
                                // Make instance of TCE for storing the changes.
                                $tce = GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class);
                                $tce->stripslashes_values = 0;
-                               $tce->start($storeRec, array(), $beUser);
                                // This is so the user can actually update his user record.
                                // This is so the user can actually update his user record.
-                               $tce->admin = 1;
+                               $isAdmin = $beUser->user['admin'];
+                               $beUser->user['admin'] = 1;
+                               $tce->start($storeRec, array(), $beUser);
                                // This is to make sure that the users record can be updated even if in another workspace. This is tolerated.
                                $tce->bypassWorkspaceRestrictions = TRUE;
                                $tce->process_datamap();
                                // This is to make sure that the users record can be updated even if in another workspace. This is tolerated.
                                $tce->bypassWorkspaceRestrictions = TRUE;
                                $tce->process_datamap();
@@ -279,6 +280,8 @@ class SetupModuleController {
                                if ($this->passwordIsUpdated === self::PASSWORD_NOT_UPDATED || count($storeRec['be_users'][$beUserId]) > 1) {
                                        $this->setupIsUpdated = TRUE;
                                }
                                if ($this->passwordIsUpdated === self::PASSWORD_NOT_UPDATED || count($storeRec['be_users'][$beUserId]) > 1) {
                                        $this->setupIsUpdated = TRUE;
                                }
+                               // Restore admin status after processing
+                               $beUser->user['admin'] = $isAdmin;
                        }
                }
        }
                        }
                }
        }