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