"); if ($_SESSION['userlevel'] != '10') { include("includes/error-no-perm.inc.php"); } else { if ($_GET['user_id']) { $user_data = dbFetchRow("SELECT * FROM users WHERE user_id = ?", array($_GET['user_id'])); echo("

" . $user_data['realname'] . "

Change...

"); // Perform actions if requested if ($_GET['action'] == "deldevperm") { if (dbFetchCell("SELECT COUNT(*) FROM devices_perms WHERE `device_id` = ? AND `user_id` = ?", array($_GET['device_id'] ,$_GET['user_id']))) { dbDelete('devices_perms', "`device_id` = ? AND `user_id` = ?", array($_GET['device_id'], $_GET['user_id'])); } } if ($_GET['action'] == "adddevperm") { if (!dbFetchCell("SELECT COUNT(*) FROM devices_perms WHERE `device_id` = ? AND `user_id` = ?", array($_GET['device_id'] ,$_GET['user_id']))) { dbInsert(array('device_id' => $_GET['device_id'], 'user_id' => $_GET['user_id']), 'devices_perms'); } } if ($_GET['action'] == "delifperm") { if (dbFetchCell("SELECT COUNT(*) FROM ports_perms WHERE `interface_id` = ? AND `user_id` = ?", array($_GET['interface_id'], $_GET['user_id']))) { dbDelete('ports_perms', "`interface_id` = ? AND `user_id` = ?", array($_GET['interface_id'], $_GET['user_id'])); } } if ($_GET['action'] == "addifperm") { if (!dbFetchCell("SELECT COUNT(*) FROM ports_perms WHERE `interface_id` = ? AND `user_id` = ?", array($_GET['interface_id'], $_GET['user_id']))) { dbInsert(array('interface_id' => $_GET['interface_id'], 'user_id' => $_GET['user_id']), 'ports_perms'); } } if ($_GET['action'] == "delbillperm") { if (dbFetchCell("SELECT COUNT(*) FROM bill_perms WHERE `bill_id` = ? AND `user_id` = ?", array($_GET['bill_id'], $_GET['user_id']))) { dbDelete('bill_perms', "`bill_id` = ? AND `user_id` = ?", array($_GET['bill_id'], $_GET['user_id'])); } } if ($_GET['action'] == "addbillperm") { if (!dbFetchCell("SELECT COUNT(*) FROM bill_perms WHERE `bill_id` = ? AND `user_id` = ?", array($_GET['bill_id'], $_GET['user_id']))) { dbInsert(array('bill_id' => $_GET['bill_id'], 'user_id' => $_GET['user_id']), 'bill_perms'); } } echo("
"); // Display devices this users has access to echo("

Device Access

"); $device_perms = dbFetchRows("SELECT * from devices_perms as P, devices as D WHERE `user_id` = ? AND D.device_id = P.device_id", array($_GET['user_id'])); foreach ($device_perms as $device_perm) { echo("" . $device_perm['hostname'] . "
"); $access_list[] = $device_perm['device_id']; $permdone = "yes"; } if (!$permdone) { echo("None Configured"); } // Display devices this user doesn't have access to echo("

Grant access to new device

"); echo("
"); echo("
"); echo("

Interface Access

"); $interface_perms = dbFetchRows("SELECT * from ports_perms as P, ports as I, devices as D WHERE `user_id` = ? AND I.interface_id = P.interface_id AND D.device_id = I.device_id", array($_GET['user_id'])); foreach ($interface_perms as $interface_perm) { echo("
".$interface_perm['hostname']." - ".$interface_perm['ifDescr']."
". "" . $interface_perm['ifAlias'] . "
  
"); $ipermdone = "yes"; } if (!$ipermdone) { echo("None Configured"); } // Display devices this user doesn't have access to echo("

Grant access to new interface

"); echo("
Device:
Interface:
"); echo("
"); echo("

Bill Access

"); $bill_perms = dbFetchRows("SELECT * from bills AS B, bill_perms AS P WHERE P.user_id = ? AND P.bill_id = B.bill_id", array($_GET['user_id'])); foreach ($bill_perms as $bill_perm) { echo("
".$bill_perm['bill_name']."  
"); $bill_access_list[] = $bill_perm['bill_id']; $bpermdone = "yes"; } if (!$bpermdone) { echo("None Configured"); } // Display devices this user doesn't have access to echo("

Grant access to new bill

"); echo("
"); echo("
"); } else { $user_list = dbFetchRows("SELECT * FROM `users`"); echo("

Select a user to edit

"); echo("
"); } } echo(""); ?>