set setupuser in create_admin setup cli function
authorPhilipp Schüle <p.schuele@metaways.de>
Tue, 13 Jun 2017 12:53:40 +0000 (14:53 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Tue, 13 Jun 2017 13:44:03 +0000 (15:44 +0200)
Change-Id: I763155ac8fd6ad8dff1df883b595301d8f6f0ec6
Reviewed-on: http://gerrit.tine20.com/customers/4868
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Jenkins CI (http://ci.tine20.com/)
tine20/Setup/Frontend/Cli.php

index 2d641aa..c7d1bf4 100644 (file)
@@ -48,7 +48,7 @@ class Setup_Frontend_Cli
     public function handle(Zend_Console_Getopt $_opts, $exitAfterHandle = true)
     {
         Setup_Core::set(Setup_Core::USER, 'setupuser');
-        
+
         $result = 0;
         if (isset($_opts->install)) {
             $this->_install($_opts);
@@ -598,7 +598,12 @@ class Setup_Frontend_Cli
         if (! Setup_Controller::getInstance()->isInstalled('Tinebase')) {
             die('Install Tinebase first.');
         }
-        
+
+        $setupUser = Setup_Update_Abstract::getSetupFromConfigOrCreateOnTheFly();
+        if (! Tinebase_Core::getUser() instanceof Tinebase_Model_User) {
+            Tinebase_Core::set(Tinebase_Core::USER, $setupUser);
+        }
+
         echo "Please enter a username. An existing user is reactivated and you can reset the password.\n";
         $username = strtolower(Tinebase_Server_Cli::promptInput('Username'));
         $tomorrow = Tinebase_DateTime::now()->addDay(1);