]> source.dussan.org Git - nextcloud-server.git/commitdiff
LDAP: make oc_user_ldap::getUsers make use of central OC_LDAP
authorArthur Schiwon <blizzz@owncloud.com>
Thu, 3 May 2012 21:41:08 +0000 (23:41 +0200)
committerArthur Schiwon <blizzz@owncloud.com>
Fri, 4 May 2012 11:26:07 +0000 (13:26 +0200)
apps/user_ldap/user_ldap.php

index 1a37630aad472da08b89740ad53ceeb10e241701..d24af5e2f82a5ace4097208a18292c0c5eae28fb 100755 (executable)
@@ -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;
        }
 
+
 }
 
 ?>