summaryrefslogtreecommitdiffstats
path: root/settings/ajax/togglesubadmins.php
blob: 8e91af62c5b0b1cc0f2781a55d8b720ed135761b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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();