diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2015-04-13 10:32:18 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2015-04-13 11:42:56 +0200 |
commit | b21dc35355b649afc6112cad390170659282a86b (patch) | |
tree | 3b1407d557347e29068469ac4763ca18815a634c /apps/provisioning_api/lib/users.php | |
parent | 0a72e66e9feaf555c485f312de1cd3377aeb6a9f (diff) | |
download | nextcloud-server-b21dc35355b649afc6112cad390170659282a86b.tar.gz nextcloud-server-b21dc35355b649afc6112cad390170659282a86b.zip |
Do not try to make user subadmin of group twice
If the provisioning api is used to make a user subadmin of a group that user
is already a subadmin just return success.
Added unit test to ensure things keep working.
Diffstat (limited to 'apps/provisioning_api/lib/users.php')
-rw-r--r-- | apps/provisioning_api/lib/users.php | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/apps/provisioning_api/lib/users.php b/apps/provisioning_api/lib/users.php index 33139bb2cef..6169ea16f9c 100644 --- a/apps/provisioning_api/lib/users.php +++ b/apps/provisioning_api/lib/users.php @@ -292,6 +292,10 @@ class Users { if(strtolower($group) == 'admin') { return new OC_OCS_Result(null, 103, 'Cannot create subadmins for admin group'); } + // We cannot be subadmin twice + if (OC_Subadmin::isSubAdminOfGroup($user, $group)) { + return new OC_OCS_Result(null, 100); + } // Go if(OC_Subadmin::createSubAdmin($user, $group)) { return new OC_OCS_Result(null, 100); |