mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
refactor: Refactored authorizers to classes (#7497)
* Refactored authorizers to classes * Merge changes for #7335 * ! fix php 5.3 incompatibility * Update ADAuthorizationAuthorizer.php * Fix get_user -> getUser * Rename AuthorizerFactory to Auth, fix interface missing functions * Add phpdocs to all interface methods and normalize the names a bit. * Re-work auth_test.php AD bind tests to work properly with the new class. Reflection is not the nicest tool, but I think it is appropriate here. Handle exceptions more nicely in auth_test.php * Restore AD getUseList fix Not sure how it got removed * fix auth_test.php style
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use LibreNMS\Authentication\Auth;
|
||||
|
||||
echo '<div style="margin: 10px;">';
|
||||
|
||||
if ($_SESSION['userlevel'] < 10 || $_SESSION['userlevel'] > 10) {
|
||||
@@ -9,12 +11,12 @@ if ($_SESSION['userlevel'] < 10 || $_SESSION['userlevel'] > 10) {
|
||||
|
||||
$pagetitle[] = 'Delete user';
|
||||
|
||||
if (auth_usermanagement()) {
|
||||
if (Auth::get()->canManageUsers()) {
|
||||
if ($vars['action'] == 'del') {
|
||||
$delete_username = dbFetchCell('SELECT username FROM users WHERE user_id = ?', array($vars['id']));
|
||||
|
||||
if ($vars['confirm'] == 'yes') {
|
||||
if (deluser($vars['id']) >= 0) {
|
||||
if (Auth::get()->deleteUser($vars['id']) >= 0) {
|
||||
print_message('<div class="infobox">User "'.$delete_username.'" deleted!');
|
||||
} else {
|
||||
print_error('Error deleting user "'.$delete_username.'"!');
|
||||
|
Reference in New Issue
Block a user