nextcloud/settings/ajax/togglesubadmins.php

19 lines
392 B
PHP
Raw Normal View History

2012-10-16 19:57:07 +04:00
<?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();