fix tooglegroup for subadmins

This commit is contained in:
Georg Ehrke 2012-07-20 15:13:51 +02:00
parent e42f765697
commit 7f08c84739

View file

@ -3,7 +3,7 @@
// Init owncloud
require_once('../../lib/base.php');
OC_JSON::checkAdminUser();
OC_JSON::checkSubAdminUser();
OCP\JSON::callCheck();
$success = true;
@ -13,6 +13,12 @@ $action = "add";
$username = $_POST["username"];
$group = OC_Util::sanitizeHTML($_POST["group"]);
if(!OC_Group::inGroup(OC_User::getUser(), 'admin') && (!OC_SubAdmin::isUserAccessible(OC_User::getUser(), $username) || !OC_SubAdmin::isGroupAccessible(OC_User::getUser(), $group))){
$l = OC_L10N::get('core');
OC_JSON::error(array( 'data' => array( 'message' => $l->t('Authentication error') )));
exit();
}
if(!OC_Group::groupExists($group)){
OC_Group::createGroup($group);
}