diff options
author | Lukas Reschke <lukas@owncloud.com> | 2015-10-27 14:09:45 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2015-10-29 11:31:18 +0100 |
commit | c6f6a8758b3f08e47c3a8f45a67d09698376b2e2 (patch) | |
tree | bfd52190961e28ae97fa65a96df05b1fe0390a2f /settings/ajax/togglesubadmins.php | |
parent | f428d31a5d1f91c6e7aa96fd8550c75c02cc0963 (diff) | |
download | nextcloud-server-c6f6a8758b3f08e47c3a8f45a67d09698376b2e2.tar.gz nextcloud-server-c6f6a8758b3f08e47c3a8f45a67d09698376b2e2.zip |
Drop OC_SubAdmin and replace usages
Diffstat (limited to 'settings/ajax/togglesubadmins.php')
-rw-r--r-- | settings/ajax/togglesubadmins.php | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/settings/ajax/togglesubadmins.php b/settings/ajax/togglesubadmins.php index 767baa9f3ee..6d6bf6d6724 100644 --- a/settings/ajax/togglesubadmins.php +++ b/settings/ajax/togglesubadmins.php @@ -27,11 +27,20 @@ OCP\JSON::callCheck(); $username = (string)$_POST['username']; $group = (string)$_POST['group']; +$subAdminManager = \OC::$server->getGroupManager()->getSubAdmin(); +$targetUserObject = \OC::$server->getUserManager()->get($username); +$targetGroupObject = \OC::$server->getGroupManager()->get($group); + +$isSubAdminOfGroup = false; +if($targetUserObject !== null && $targetUserObject !== null) { + $isSubAdminOfGroup = $subAdminManager->isSubAdminofGroup($targetUserObject, $targetGroupObject); +} + // Toggle group -if(OC_SubAdmin::isSubAdminofGroup($username, $group)) { - OC_SubAdmin::deleteSubAdmin($username, $group); -}else{ - OC_SubAdmin::createSubAdmin($username, $group); +if($isSubAdminOfGroup) { + $subAdminManager->deleteSubAdmin($targetUserObject, $targetGroupObject); +} else { + $subAdminManager->createSubAdmin($targetUserObject, $targetGroupObject); } OC_JSON::success(); |