simplify code of remoteuser.php

remotes/origin/stable45
Georg Ehrke 2012-07-19 16:35:14 +07:00
parent 6e139f16e4
commit ffc55f3510
1 changed files with 4 additions and 14 deletions

@ -8,20 +8,10 @@ OCP\JSON::callCheck();
$username = $_POST["username"];
if(!OC_Group::inGroup(OC_User::getUser(), 'admin') && OC_SubAdmin::isSubAdmin(OC_User::getUser())){
$accessiblegroups = OC_SubAdmin::getSubAdminsGroups(OC_User::getUser());
$isuseraccessible = false;
foreach($accessiblegroups as $accessiblegroup){
if(OC_Group::inGroup($username, $accessiblegroup)){
$isuseraccessible = true;
break;
}
}
if(!$isuseraccessible){
$l = OC_L10N::get('core');
self::error(array( 'data' => array( 'message' => $l->t('Authentication error') )));
exit();
}
if(!OC_Group::inGroup(OC_User::getUser(), 'admin') && !OC_SubAdmin::isUserAccessible(OC_User::getUser(), $username)){
$l = OC_L10N::get('core');
self::error(array( 'data' => array( 'message' => $l->t('Authentication error') )));
exit();
}
// Return Success story