[TASK] Add main admin to system maintainers during first install 99/54099/5
authorSimon Praetorius <simon@praetorius.me>
Sun, 10 Sep 2017 11:41:59 +0000 (13:41 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 6 Oct 2017 09:25:10 +0000 (11:25 +0200)
Resolves: #82439
Related: #82319
Releases: master
Change-Id: Ieabaf1e7a230ce82206ffea30efded9ba821d50f
Reviewed-on: https://review.typo3.org/54099
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Markus Sommer <markus.sommer@typo3.org>
Tested-by: Markus Sommer <markus.sommer@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/install/Classes/Controller/InstallerController.php

index c6457c5..bf7e245 100644 (file)
@@ -633,6 +633,7 @@ class InstallerController
         $databaseConnection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable('be_users');
         try {
             $databaseConnection->insert('be_users', $adminUserFields);
+            $adminUserUid = (int)$databaseConnection->lastInsertId('be_users');
         } catch (DBALException $exception) {
             $messages[] = new FlashMessage(
                 'The administrator account could not be created. The following error occurred:' . LF
@@ -645,9 +646,11 @@ class InstallerController
                 'status' => $messages,
             ]);
         }
-        // Set password as install tool password
-        $configurationManager->setLocalConfigurationValueByPath('BE/installToolPassword', $this->getHashedPassword($password));
-
+        // Set password as install tool password, add admin user to system maintainers
+        $configurationManager->setLocalConfigurationValuesByPathValuePairs([
+            'BE/installToolPassword' => $this->getHashedPassword($password),
+            'SYS/systemMaintainers' => [$adminUserUid]
+        ]);
         return new JsonResponse([
             'success' => true,
             'status' => $messages,