summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/user_ldap.php
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2012-05-03 23:41:08 +0200
committerArthur Schiwon <blizzz@owncloud.com>2012-05-04 13:26:07 +0200
commit6f982d2e202fe61413d736d49e24dc85c9c1684f (patch)
treecbf079aa2f5769f0c7a694a77a969b3650ab8e93 /apps/user_ldap/user_ldap.php
parent7a06e144ec71ef162bfc4fece886e3cb3f8d1188 (diff)
downloadnextcloud-server-6f982d2e202fe61413d736d49e24dc85c9c1684f.tar.gz
nextcloud-server-6f982d2e202fe61413d736d49e24dc85c9c1684f.zip
LDAP: make oc_user_ldap::getUsers make use of central OC_LDAP
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;
}
+
}
?>