summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/user_ldap.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/user_ldap/user_ldap.php')
-rwxr-xr-xapps/user_ldap/user_ldap.php39
1 files changed, 11 insertions, 28 deletions
diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php
index 1a37630aad4..d24af5e2f82 100755
--- a/apps/user_ldap/user_ldap.php
+++ b/apps/user_ldap/user_ldap.php
@@ -193,36 +193,19 @@ class OC_USER_LDAP extends OC_User_Backend {
return !empty($dn);
}
- public function getUsers()
- {
- if(!$this->configured)
- return false;
-
- // connect to server
- $ds = $this->getDs();
- if( !$ds )
- return false;
-
- // 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;
- }
+ /**
+ * @brief Get a list of all users
+ * @returns array with all uids
+ *
+ * Get a list of all users.
+ */
+ public static function getUsers(){
+ $ldap_users = OC_LDAP::fetchListOfUsers($this->ldapUserFilter, array(OC_LDAP::conf('ldapGroupDisplayName'), 'dn'));
+ $users = OC_LDAP::ownCloudUserNames($ldap_users);
+ return $users;
}
+
}
?>