diff options
author | blizzz <blizzz@arthur-schiwon.de> | 2019-11-25 17:16:40 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-25 17:16:40 +0100 |
commit | b1dffc5c2dd17216c87788bf36b8e15b45be2241 (patch) | |
tree | 164de89542956784da0c7046c5fb00c09aa423ea /core/Command/User | |
parent | 279c0cb2ed99c3914f19468c267344aa3a2f04e6 (diff) | |
parent | b4408e4245ca4045df7a5f8fdf6ba9100730fa4f (diff) | |
download | nextcloud-server-b1dffc5c2dd17216c87788bf36b8e15b45be2241.tar.gz nextcloud-server-b1dffc5c2dd17216c87788bf36b8e15b45be2241.zip |
Merge pull request #17896 from nextcloud/fix/noid/consider-create-group-result
take group creation result into consideration
Diffstat (limited to 'core/Command/User')
-rw-r--r-- | core/Command/User/Add.php | 11 |
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() . '"'); } } } |