mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
This reverts commit baab9596a0
.
This commit is contained in:
@@ -9,7 +9,6 @@ use LibreNMS\Exceptions\LdapMissingException;
|
||||
class LdapAuthorizer extends AuthorizerBase
|
||||
{
|
||||
protected $ldap_connection;
|
||||
private $userloginname = "";
|
||||
|
||||
public function authenticate($credentials)
|
||||
{
|
||||
@@ -17,7 +16,6 @@ class LdapAuthorizer extends AuthorizerBase
|
||||
|
||||
if (!empty($credentials['username'])) {
|
||||
$username = $credentials['username'];
|
||||
$this->userloginname = $username;
|
||||
if (!empty($credentials['password']) && ldap_bind($connection, $this->getFullDn($username), $credentials['password'])) {
|
||||
$ldap_groups = $this->getGroupList();
|
||||
if (empty($ldap_groups)) {
|
||||
@@ -200,22 +198,10 @@ class LdapAuthorizer extends AuthorizerBase
|
||||
|
||||
public function getUser($user_id)
|
||||
{
|
||||
$connection = $this->getLdapConnection();
|
||||
|
||||
$filter = '(' . Config::get('auth_ldap_prefix') . '*)';
|
||||
if (Config::get('auth_ldap_userlist_filter') != null) {
|
||||
$filter = '(' . Config::get('auth_ldap_userlist_filter') . ')';
|
||||
}
|
||||
|
||||
$search = ldap_search($connection, $this->getFullDn($this->userloginname), $filter);
|
||||
$entries = ldap_get_entries($connection, $search);
|
||||
foreach ($entries as $entry) {
|
||||
$user = $this->ldapToUser($entry);
|
||||
if ((int)$user['user_id'] !== (int)$user_id) {
|
||||
continue;
|
||||
foreach ($this->getUserlist() as $user) {
|
||||
if ((int)$user['user_id'] === (int)$user_id) {
|
||||
return $user;
|
||||
}
|
||||
|
||||
return $user;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user