";
$pagetitle[] = 'Edit user';
if (! Auth::user()->hasGlobalAdmin()) {
include 'includes/html/error-no-perm.inc.php';
} else {
if ($vars['user_id'] && !$vars['edit']) {
/** @var User $user */
$user = User::find($vars['user_id']);
$user_data = $user->toArray(); // for compatibility with current code
echo '
';
// Display devices this users has access to
echo '
Device Access
';
echo "
| Device |
Action |
";
$device_perms = dbFetchRows('SELECT * from devices_perms as P, devices as D WHERE `user_id` = ? AND D.device_id = P.device_id', array($user_data['user_id']));
foreach ($device_perms as $device_perm) {
echo '| '.format_hostname($device_perm)." | |
";
$access_list[] = $device_perm['device_id'];
$permdone = 'yes';
}
echo '
';
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.port_id = P.port_id AND D.device_id = I.device_id', array($user_data['user_id']));
echo "
| Interface name |
Action |
";
foreach ($interface_perms as $interface_perm) {
echo '
|
'.$interface_perm['hostname'].' - '.$interface_perm['ifDescr'].''.''.display($interface_perm['ifAlias'])."
|
|
";
$ipermdone = 'yes';
}
echo '
';
if (!$ipermdone) {
echo 'None Configured';
}
// Display devices this user doesn't have access to
echo '
Grant access to new interface
';
echo "
";
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($user_data['user_id']));
echo "
| Bill name |
Action |
";
foreach ($bill_perms as $bill_perm) {
echo '
|
'.$bill_perm['bill_name']." |
|
";
$bill_access_list[] = $bill_perm['bill_id'];
$bpermdone = 'yes';
}
echo '
';
if (!$bpermdone) {
echo 'None Configured';
}
// Display devices this user doesn't have access to
echo '
Grant access to new bill
';
echo "
";
} else {
echo '';
}//end if
}//end if
echo '
';