]> _ Git - cubist_util.git/commitdiff
wip #7406 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 20 Mar 2025 10:27:41 +0000 (11:27 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 20 Mar 2025 10:27:41 +0000 (11:27 +0100)
src/CommandLine/Owncloud.php

index 40d61e7d2db83132c6cee0277687ca8f3d42d4fd..01b4c3709f357485b3b564ff4d48c588745af212 100644 (file)
@@ -19,6 +19,25 @@ class Owncloud extends CommandLine
         $this->setArg('output', 'json');
         $this->execute();
 
-        return json_decode($this->output);
+        return json_decode($this->getOutput(), true);
+    }
+
+    public function addUser($email, $userID = null, $name = '', $password = null)
+    {
+        // user:add [--password-from-env] [--generate-password] [--display-name [DISPLAY-NAME]] [-g|--group [GROUP]] [--email EMAIL] [--] <uid>
+        $this->setArg(null, 'user:add');
+        if (null === $password) {
+            $this->setArg('generate-password');
+        } else {
+            $this->setEnv('OCC_PASS', $password);
+            $this->setArg('password-from-env');
+        }
+        if ($name) {
+            $this->setArg('display-name', $name);
+        }
+        $this->setArg('email', $email);
+        $this->setArg(null, $userID ?? $email);
+        $this->execute();
+        $this->dd();
     }
 }
\ No newline at end of file