diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2012-10-27 12:18:50 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2012-10-27 12:19:08 +0200 |
commit | 605281da9bb4c575f89113c9f6399c2fe6ca9392 (patch) | |
tree | d1289f2162f14cc6a7c20a95eff510b413979336 | |
parent | 67cd268df92d396f13555e426d2486ba98483a1f (diff) | |
download | nextcloud-server-605281da9bb4c575f89113c9f6399c2fe6ca9392.tar.gz nextcloud-server-605281da9bb4c575f89113c9f6399c2fe6ca9392.zip |
LDAP: let result processing in Access::search slice the array for not-paginated search. getUsers e.g. does not need to take care of it anymore. adjustments in group_ldap to follow.
-rw-r--r-- | apps/user_ldap/lib/access.php | 11 | ||||
-rw-r--r-- | apps/user_ldap/user_ldap.php | 14 |
2 files changed, 11 insertions, 14 deletions
diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php index 536a5f8def4..d3439451499 100644 --- a/apps/user_ldap/lib/access.php +++ b/apps/user_ldap/lib/access.php @@ -579,8 +579,15 @@ abstract class Access { } } } -// die(var_dump($selection)); - return $selection; + $findings = $selection; + } + if(!$this->pagedSearchedSuccessful + || ( + !is_null($limit) + || !is_null($offset) + ) + ) { + $findings = array_slice($findings, intval($offset), $limit); } return $findings; } diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php index 011c7d55368..916d3f1d46a 100644 --- a/apps/user_ldap/user_ldap.php +++ b/apps/user_ldap/user_ldap.php @@ -119,23 +119,13 @@ class USER_LDAP extends lib\Access implements \OCP\UserInterface { $this->connection->ldapGroupDisplayName.'='.$search )); - \OCP\Util::writeLog('user_ldap', 'getUsers: Get users filter '.$filter, \OCP\Util::DEBUG); - \OCP\Util::writeLog('user_ldap', 'getUsers: Options: search '.$search.' limit '.$limit.' offset '.$offset, \OCP\Util::INFO); + \OCP\Util::writeLog('user_ldap', 'getUsers: Options: search '.$search.' limit '.$limit.' offset '.$offset.' Filter: '.$filter, \OCP\Util::DEBUG); //do the search and translate results to owncloud names $ldap_users = $this->fetchListOfUsers($filter, array($this->connection->ldapUserDisplayName, 'dn'), $limit, $offset); $ldap_users = $this->ownCloudUserNames($ldap_users); - \OCP\Util::writeLog('user_ldap', 'getUsers: '.count($ldap_users). ' Users found', \OCP\Util::INFO); - - //if bigger, then paged search is not supported - if(!$this->getPagedSearchResultState()) { - \OCP\Util::writeLog('user_ldap', 'getUsers: We got old-style results', \OCP\Util::DEBUG); - //if not supported, a 'normal' search has run automatically, we just need to get our slice of the cake. And we cache the general search, too - $this->connection->writeToCache('getUsers-'.$search, $ldap_users); - $ldap_users = array_slice($ldap_users, $offset, $limit); - } + \OCP\Util::writeLog('user_ldap', 'getUsers: '.count($ldap_users). ' Users found', \OCP\Util::DEBUG); $this->connection->writeToCache($cachekey, $ldap_users); - \OCP\Util::writeLog('user_ldap', 'getUsers: '.count($ldap_users). ' Users returned', \OCP\Util::DEBUG); return $ldap_users; } |