mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
add get_userlist function, pull from LDAP in case of LDAP backend -- now awaiting fix of edituser page
git-svn-id: http://www.observium.org/svn/observer/trunk@2545 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@ -69,4 +69,9 @@ function deluser($username)
|
||||
return 0;
|
||||
}
|
||||
|
||||
function get_userlist()
|
||||
{
|
||||
return dbFetchRows("SELECT * FROM `users`");
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -121,4 +121,31 @@ function deluser($username)
|
||||
return 0;
|
||||
}
|
||||
|
||||
function get_userlist()
|
||||
{
|
||||
global $config, $ds;
|
||||
|
||||
$filter = '(' . $config['auth_ldap_prefix'] . '*)';
|
||||
|
||||
$search = ldap_search($ds, trim($config['auth_ldap_suffix'],','), $filter);
|
||||
$entries = ldap_get_entries($ds, $search);
|
||||
|
||||
if ($entries['count'])
|
||||
{
|
||||
foreach ($entries as $entry)
|
||||
{
|
||||
$username = $entry['uid'][0];
|
||||
$realname = $entry['cn'][0];
|
||||
$user_id = $entry['uidnumber'][0];
|
||||
|
||||
if (!isset($config['auth_ldap_group']) || ldap_compare($ds,$config['auth_ldap_group'],'memberUid',$username))
|
||||
{
|
||||
$userlist[] = array('username' => $username, 'realname' => $realname, 'user_id' => $user_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $userlist;
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -110,5 +110,9 @@ function deluser($username)
|
||||
|
||||
}
|
||||
|
||||
function get_userlist()
|
||||
{
|
||||
return dbFetchRows("SELECT * FROM `users`");
|
||||
}
|
||||
|
||||
?>
|
||||
|
Reference in New Issue
Block a user