summaryrefslogtreecommitdiffstats
path: root/settings/ajax/togglesubadmins.php
diff options
context:
space:
mode:
authorGeorg Ehrke <dev@georgswebsite.de>2012-07-15 16:32:57 +0200
committerGeorg Ehrke <dev@georgswebsite.de>2012-07-15 16:32:57 +0200
commit044134a289339e0b7dbcbfa9f5603efca1dfea81 (patch)
treee9a82287474b0d5595e677acc5ad5f6741dc32bb /settings/ajax/togglesubadmins.php
parente707e948577b927a28b86545d345e7b6c8606352 (diff)
downloadnextcloud-server-044134a289339e0b7dbcbfa9f5603efca1dfea81.tar.gz
nextcloud-server-044134a289339e0b7dbcbfa9f5603efca1dfea81.zip
add another file which was missing in the previous commit
Diffstat (limited to 'settings/ajax/togglesubadmins.php')
-rw-r--r--settings/ajax/togglesubadmins.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/settings/ajax/togglesubadmins.php b/settings/ajax/togglesubadmins.php
new file mode 100644
index 00000000000..8e91af62c5b
--- /dev/null
+++ b/settings/ajax/togglesubadmins.php
@@ -0,0 +1,23 @@
+<?php
+
+// Init owncloud
+require_once('../../lib/base.php');
+
+OC_JSON::checkAdminUser();
+OCP\JSON::callCheck();
+
+$success = true;
+$error = "add user to";
+$action = "add";
+
+$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