Skip to content
Snippets Groups Projects
Commit 6f982d2e authored by Arthur Schiwon's avatar Arthur Schiwon
Browse files

LDAP: make oc_user_ldap::getUsers make use of central OC_LDAP

parent 7a06e144
Branches
No related tags found
No related merge requests found
...@@ -193,35 +193,18 @@ class OC_USER_LDAP extends OC_User_Backend { ...@@ -193,35 +193,18 @@ class OC_USER_LDAP extends OC_User_Backend {
return !empty($dn); return !empty($dn);
} }
public function getUsers() /**
{ * @brief Get a list of all users
if(!$this->configured) * @returns array with all uids
return false; *
* Get a list of all users.
// connect to server */
$ds = $this->getDs(); public static function getUsers(){
if( !$ds ) $ldap_users = OC_LDAP::fetchListOfUsers($this->ldapUserFilter, array(OC_LDAP::conf('ldapGroupDisplayName'), 'dn'));
return false; $users = OC_LDAP::ownCloudUserNames($ldap_users);
// get users
$sr = ldap_search( $this->getDs(), $this->ldap_base, $this->ldap_userlist_filter );
$entries = ldap_get_entries( $this->getDs(), $sr );
if( $entries['count'] == 0 )
return false;
else {
$users = array();
foreach($entries as $row) {
// TODO ldap_get_entries() seems to lower all keys => needs review
$ldap_display_name = strtolower($this->ldap_display_name);
if(isset($row[$ldap_display_name])) {
$users[] = $row[$ldap_display_name][0];
}
}
// TODO language specific sorting of user names
sort($users);
return $users; return $users;
} }
}
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment