<?

$groupInfo = $auth->getGroupInfo($auth->currentUserInfo['gid']);



function choosePerm($userPerm, $groupPerm) {
	if ($userPerm != "") {
		return $userPerm;
	} else {
		if ($groupPerm == "") {
			return 0;
		} else {
			return $groupPerm;
		}
	}
}


$permissions['suspended'] = choosePerm($auth->currentUserInfo['suspended'], $groupInfo['suspended']);
$permissions['path'] = choosePerm($auth->currentUserInfo['path'], $groupInfo['path']);
$permissions['upload'] = choosePerm($auth->currentUserInfo['upload'], $groupInfo['upload']);
$permissions['download'] = choosePerm($auth->currentUserInfo['download'], $groupInfo['download']);
$permissions['readonly'] = choosePerm($auth->currentUserInfo['readonly'], $groupInfo['readonly']);
$permissions['byemail'] = choosePerm($auth->currentUserInfo['sendbyemail'], $groupInfo['sendbyemail']);
$permissions['sharing'] = choosePerm($auth->currentUserInfo['sharing'], $groupInfo['sharing']);
$permissions['shareAccess'] = choosePerm($auth->currentUserInfo['shareaccess'], $groupInfo['shareaccess']);
$options['uploadNotice'] = choosePerm($auth->currentUserInfo['uploadnotice'], $groupInfo['uploadnotice']);
$options['downloadNotice'] = choosePerm($auth->currentUserInfo['downloadnotice'], $groupInfo['downloadnotice']);
$options['view_others'] = choosePerm($auth->currentUserInfo['view_others'], $groupInfo['view_others']);
$options['ui_type'] = choosePerm($auth->currentUserInfo['ui_type'], $groupInfo['ui_type']);
$options['ui_has_tree'] = choosePerm($auth->currentUserInfo['ui_has_tree'], $groupInfo['ui_has_tree']);


/* quotas */


if ($auth->currentUserInfo['spacequota'] == "-") {
	$permissions['unlimitedSpace'] = true;
} elseif($auth->currentUserInfo['spacequota'] == "") {
	if ($groupInfo['spacequota'] == "") {
		$permissions['unlimitedSpace'] = true;
	} else {
		$permissions['spaceQuota'] = $groupInfo['spacequota'];
	}
} else {
	$permissions['spaceQuota'] = $auth->currentUserInfo['spacequota'];
}



if ($auth->currentUserInfo['trafficquota'] == "-") {
	$permissions['unlimitedTraffic'] = true;
} elseif($auth->currentUserInfo['trafficquota'] == "") {
	if ($groupInfo['trafficquota'] == "") {
		$permissions['unlimitedTraffic'] = true;
	} else {
		$permissions['trafficQuota'] = $groupInfo['trafficquota'];
	}
} else {
	$permissions['trafficQuota'] = $auth->currentUserInfo['trafficquota'];
}

//debug($permissions);
//die();

?>