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.
This commit is contained in:
parent
67cd268df9
commit
605281da9b
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue