Files
librenms-librenms/html/pages/deluser.inc.php
Tony Murray 32a7c50189 Use Laravel authentication (#8702)
* Use Laravel for authentication
Support legacy auth methods
Always create DB entry for users (segregate by auth method)

Port api auth to Laravel

restrict poller errors to devices the user has access to

Run checks on every page load.  But set a 5 minute (configurable) timer.
Only run some checks if the user is an admin

Move toastr down a few pixels so it isn't as annoying.

Fix menu not loaded on laravel pages when twofactor is enabled for the system, but disabled for the user.
Add two missing menu entries in the laravel menu

Rewrite 2FA code
Simplify some and verify code before applying

Get http-auth working
Handle legacy $_SESSION differently.  Allows Auth::once(), etc to work.

* Fix tests and mysqli extension check

* remove duplicate Toastr messages

* Fix new items

* Rename 266.sql to 267.sql
2018-09-11 07:51:35 -05:00

66 lines
2.1 KiB
PHP

<?php
use LibreNMS\Authentication\LegacyAuth;
echo '<div style="margin: 10px;">';
if (!LegacyAuth::user()->isAdmin()) {
include 'includes/error-no-perm.inc.php';
} else {
echo '<h3>Delete User</h3>';
$pagetitle[] = 'Delete user';
if (LegacyAuth::get()->canManageUsers()) {
if ($vars['action'] == 'del') {
$id = (int)$vars['id'];
$user = LegacyAuth::get()->getUser($id);
if ($vars['confirm'] == 'yes') {
if (LegacyAuth::get()->deleteUser($id) >= 0) {
print_message('<div class="infobox">User "'.$user['username'].'" deleted!');
} else {
print_error('Error deleting user "'.$user['username'].'"!');
}
} else {
print_error('You have requested deletion of the user "'.$user['username'].'". This action can not be reversed.<br /><a class="btn btn-danger" href="deluser/action=del/id='.$id.'/confirm=yes">Click to confirm</a>');
}
}
// FIXME v mysql query should be replaced by authmodule
$userlist = LegacyAuth::get()->getUserlist();
echo '
<form role="form" class="form-horizontal" method="GET" action="">
<input type="hidden" name="action" value="del">
<div class="form-group">
<label for="user_id" class="col-sm-2 control-label">Select User: </label>
<div class="col-sm-6">
<select id="user_id" name="id" class="form-control input-sm">
';
foreach ($userlist as $userentry) {
$i++;
echo '<option value="'.$userentry['user_id'].'">'.$userentry['username'].'</option>';
}
echo '
</select>
</div>
</div>
<div class="form-group">
<div class="col-sm-2">
</div>
<div class="col-sm-6">
<button class="btn btn-danger btn-sm">Delete User</button>
</div>
</div>
</form>
';
} else {
print_error('Authentication module does not allow user management!');
}//end if
}//end if
echo '</div>';