mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
updates for port access
git-svn-id: http://www.observium.org/svn/observer/trunk@293 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -136,10 +136,10 @@ echo("<table width=100%><tr><td valign=top width=33%>");
|
||||
echo("</td><td valign=top width=33%>");
|
||||
echo("<h3>Bill Access</h3>");
|
||||
|
||||
$bill_perm_data = mysql_query("SELECT * from bills AS B, bill_perms AS P WHERE `P.user_id` = '" . $_GET['user_id'] .
|
||||
$bill_perm_data = mysql_query("SELECT * from bills AS B, bill_perms AS P WHERE P.user_id = '" . $_GET['user_id'] .
|
||||
"' AND P.bill_id = B.bill_id");
|
||||
while($bill_perm = mysql_fetch_array($bill_perm_data)) {
|
||||
|
||||
while($bill_perm = mysql_fetch_array($bill_perm_data)) {
|
||||
echo("<table><tr><td><strong>".$bill_perm['bill_name']."</strong></td><td width=50> <a href='?page=edituser&action=delifperm&user_id=" .
|
||||
$_GET['user_id'] . "&interface_id=" . $bill_perm['interface_id'] . "'><img src='images/16/cross.png' align=absmiddle border=0></a></td></tr></table>");
|
||||
$bill_access_list[] = $bill_perm['bill_id'];
|
||||
@@ -155,7 +155,7 @@ echo("<table width=100%><tr><td valign=top width=33%>");
|
||||
<input type='hidden' value='" . $_GET['user_id'] . "' name='user_id'>
|
||||
<input type='hidden' value='edituser' name='page'>
|
||||
<input type='hidden' value='addbillperm' name='action'>
|
||||
<select name='bill' class=selector>");
|
||||
<select name='bill_id' class=selector>");
|
||||
|
||||
$bills = mysql_query("SELECT * FROM `bills` ORDER BY `bill_name`");
|
||||
while($bill = mysql_fetch_array($bills)) {
|
||||
|
@@ -38,9 +38,9 @@ while($interface = mysql_fetch_array($query)) {
|
||||
$error_img = generateiflink($interface,"<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>",errors);
|
||||
} else { $error_img = ""; }
|
||||
|
||||
if( interfacepermitted($interface['interface_id']) ) {
|
||||
|
||||
echo("<tr bgcolor=$row_colour>
|
||||
if( interfacepermitted($interface['interface_id']) )
|
||||
{
|
||||
echo("<tr bgcolor=$row_colour>
|
||||
<td class=list-bold>" . generatedevicelink($interface) . "</td>
|
||||
<td class=list-bold>" . generateiflink($interface, makeshortif(fixifname($interface['ifDescr']))) . " $error_img</td>
|
||||
<td>$speed</td>
|
||||
@@ -48,7 +48,7 @@ while($interface = mysql_fetch_array($query)) {
|
||||
<td>" . $interface[ifAlias] . "</td>
|
||||
</tr>\n");
|
||||
|
||||
$row++;
|
||||
$row++;
|
||||
|
||||
}
|
||||
|
||||
|
@@ -117,20 +117,21 @@ function billpermitted($bill_id) {
|
||||
}
|
||||
|
||||
|
||||
function interfacepermitted($interface_id) {
|
||||
|
||||
function interfacepermitted($interface_id)
|
||||
{
|
||||
global $_SESSION;
|
||||
if($_SESSION['userlevel'] >= "5") {
|
||||
$allowed = TRUE;
|
||||
} elseif ( devicepermitted(mysql_result(mysql_query("SELECT device_id FROM interface WHERE interface_id = '$interface_id'"),0))) {
|
||||
$allowed = TRUE;
|
||||
} elseif ( @mysql_result(mysql_query("SELECT count(*) FROM interface_perms WHERE `user_id` = '" . $_SESSION['user_id'] . "' AND `interface_id` = $interface_id"), 0) > '0') {
|
||||
} elseif ( @mysql_result(mysql_query("SELECT interface_id FROM interfaces_perms WHERE `user_id` = '" . $_SESSION['user_id'] . "' AND `interface_id` = $interface_id"), 0)) {
|
||||
$allowed = TRUE;
|
||||
} else { $allowed = FALSE; }
|
||||
return $allowed;
|
||||
}
|
||||
|
||||
function devicepermitted($device_id) {
|
||||
function devicepermitted($device_id)
|
||||
{
|
||||
global $_SESSION;
|
||||
if($_SESSION['userlevel'] >= "5") { $allowed = true;
|
||||
} elseif ( @mysql_result(mysql_query("SELECT * FROM devices_perms WHERE `user_id` = '" . $_SESSION['user_id'] . "' AND `device_id` = $device_id"), 0) > '0' ) {
|
||||
@@ -140,17 +141,20 @@ function devicepermitted($device_id) {
|
||||
|
||||
}
|
||||
|
||||
function formatRates($rate) {
|
||||
function formatRates($rate)
|
||||
{
|
||||
$rate = format_si($rate) . "bps";
|
||||
return $rate;
|
||||
}
|
||||
|
||||
function formatstorage($rate) {
|
||||
function formatstorage($rate)
|
||||
{
|
||||
$rate = format_bi($rate) . "B";
|
||||
return $rate;
|
||||
}
|
||||
|
||||
function format_si($rate) {
|
||||
function format_si($rate)
|
||||
{
|
||||
$sizes = Array('', 'K', 'M', 'G', 'T', 'P', 'E');
|
||||
$round = Array('0','0','0','2','2','2','2','2','2');
|
||||
$ext = $sizes[0];
|
||||
|
Reference in New Issue
Block a user