From: Vincent Vanwaelscappel Date: Thu, 20 Mar 2025 10:27:41 +0000 (+0100) Subject: wip #7406 @1 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=ad851a6f5282cde38d27b2f639ad2019c76b9497;p=cubist_util.git wip #7406 @1 --- diff --git a/src/CommandLine/Owncloud.php b/src/CommandLine/Owncloud.php index 40d61e7..01b4c37 100644 --- a/src/CommandLine/Owncloud.php +++ b/src/CommandLine/Owncloud.php @@ -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] [--] + $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