summaryrefslogtreecommitdiffstats
path: root/settings/ajax/togglesubadmins.php
diff options
context:
space:
mode:
Diffstat (limited to 'settings/ajax/togglesubadmins.php')
-rw-r--r--settings/ajax/togglesubadmins.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/settings/ajax/togglesubadmins.php b/settings/ajax/togglesubadmins.php
new file mode 100644
index 00000000000..42db8450302
--- /dev/null
+++ b/settings/ajax/togglesubadmins.php
@@ -0,0 +1,19 @@
+<?php
+
+// Init owncloud
+require_once('../../lib/base.php');
+
+OC_JSON::checkAdminUser();
+OCP\JSON::callCheck();
+
+$username = $_POST["username"];
+$group = OC_Util::sanitizeHTML($_POST["group"]);
+
+// Toggle group
+if(OC_SubAdmin::isSubAdminofGroup($username, $group)){
+ OC_SubAdmin::deleteSubAdmin($username, $group);
+}else{
+ OC_SubAdmin::createSubAdmin($username, $group);
+}
+
+OC_JSON::success(); \ No newline at end of file