graphing system updates

git-svn-id: http://www.observium.org/svn/observer/trunk@1599 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2010-08-01 14:17:06 +00:00
parent 29d169ce06
commit 3d937d28e9
46 changed files with 361 additions and 246 deletions

View File

@ -75,7 +75,7 @@ function generatedevicelink($device, $text=0, $start=0, $end=0)
}
$text = htmlentities($text);
$link = overlib_link($url, $text, $contents, $class);
if(devicepermitted($device['device_id'])) {
if(device_permitted($device['device_id'])) {
return $link;
} else {
return $device['hostname'];
@ -156,13 +156,14 @@ function bill_permitted($bill_id)
return $allowed;
}
function interfacepermitted($interface_id, $device_id = NULL)
function port_permitted($interface_id, $device_id = NULL)
{
global $_SESSION; global $permissions;
if(!$device_id) { $device_id = mysql_result(mysql_query("SELECT `device_id` from ports WHERE interface_id = '".$interface_id."'"),0); }
if(!is_numeric($device_id)) { $device_id = get_device_id_by_interface_id($interface_id); }
if ($_SESSION['userlevel'] >= "5") {
$allowed = TRUE;
} elseif ( devicepermitted($device_id)) {
} elseif ( device_permitted($device_id)) {
$allowed = TRUE;
} elseif ( $permissions['port'][$interface_id]) {
$allowed = TRUE;
@ -172,7 +173,29 @@ function interfacepermitted($interface_id, $device_id = NULL)
return $allowed;
}
function devicepermitted($device_id)
function application_permitted($app_id, $device_id = NULL)
{
global $_SESSION; global $permissions;
if(is_numeric($app_id))
{
if(!$device_id) { $device_id = device_by_id_cache ($app_id); }
if ($_SESSION['userlevel'] >= "5") {
$allowed = TRUE;
} elseif ( device_permitted($device_id)) {
$allowed = TRUE;
} elseif ( $permissions['application'][$app_id]) {
$allowed = TRUE;
} else {
$allowed = FALSE;
}
} else {
$allowed = FALSE;
}
return $allowed;
}
function device_permitted($device_id)
{
global $_SESSION; global $permissions;
if ($_SESSION['userlevel'] >= "5") {
@ -250,7 +273,7 @@ function generate_if_link($args, $text = NULL)
$url = $config['base_url']."/device/".$args['device_id']."/interface/" . $args['interface_id'] . "/";
if(interfacepermitted($args['interface_id'])) {
if(port_permitted($args['interface_id'])) {
return overlib_link($url, $text, $content, $class);
} else {
return fixifName($text);