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:
@@ -22,6 +22,7 @@
|
||||
* @subpackage Alerts
|
||||
*/
|
||||
|
||||
use LibreNMS\Authentication\Auth;
|
||||
|
||||
/**
|
||||
* Generate SQL from Rule
|
||||
@@ -231,14 +232,14 @@ function RunRules($device)
|
||||
*/
|
||||
function GetContacts($results)
|
||||
{
|
||||
global $config;
|
||||
global $config, $authorizer;
|
||||
if (sizeof($results) == 0) {
|
||||
return array();
|
||||
}
|
||||
if ($config['alert']['default_only'] === true || $config['alerts']['email']['default_only'] === true) {
|
||||
return array(''.($config['alert']['default_mail'] ? $config['alert']['default_mail'] : $config['alerts']['email']['default']) => 'NOC');
|
||||
}
|
||||
$users = get_userlist();
|
||||
$users = Auth::get()->getUserlist();
|
||||
$contacts = array();
|
||||
$uids = array();
|
||||
foreach ($results as $result) {
|
||||
@@ -280,7 +281,7 @@ function GetContacts($results)
|
||||
$user['realname'] = $user['username'];
|
||||
}
|
||||
if (empty($user['level'])) {
|
||||
$user['level'] = get_userlevel($user['username']);
|
||||
$user['level'] = Auth::get()->getUserlevel($user['username']);
|
||||
}
|
||||
if ($config['alert']['globals'] && ( $user['level'] >= 5 && $user['level'] < 10 )) {
|
||||
$contacts[$user['email']] = $user['realname'];
|
||||
|
Reference in New Issue
Block a user