aboutsummaryrefslogtreecommitdiffstats
path: root/core/Command/User/Add.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/Command/User/Add.php')
-rw-r--r--core/Command/User/Add.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/core/Command/User/Add.php b/core/Command/User/Add.php
index 047881fc37f..4dbf55b3fb8 100644
--- a/core/Command/User/Add.php
+++ b/core/Command/User/Add.php
@@ -25,6 +25,7 @@
namespace OC\Core\Command\User;
use OC\Files\Filesystem;
+use OCP\IGroup;
use OCP\IGroupManager;
use OCP\IUser;
use OCP\IUserManager;
@@ -152,10 +153,14 @@ class Add extends Command {
if (!$group) {
$this->groupManager->createGroup($groupName);
$group = $this->groupManager->get($groupName);
- $output->writeln('Created group "' . $group->getGID() . '"');
+ if($group instanceof IGroup) {
+ $output->writeln('Created group "' . $group->getGID() . '"');
+ }
+ }
+ if($group instanceof IGroup) {
+ $group->addUser($user);
+ $output->writeln('User "' . $user->getUID() . '" added to group "' . $group->getGID() . '"');
}
- $group->addUser($user);
- $output->writeln('User "' . $user->getUID() . '" added to group "' . $group->getGID() . '"');
}
}
}