mirror of
https://github.com/nextcloud/server.git
synced 2026-05-15 18:11:30 -04:00
iterate over bases instead of doing parallel search
parallel search is not compatible with paged search, but the letter is usually always applied. Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
parent
3494f2794d
commit
2b8a669d31
1 changed files with 28 additions and 5 deletions
|
|
@ -975,7 +975,11 @@ class Access extends LDAPUtility {
|
|||
* Executes an LDAP search
|
||||
*/
|
||||
public function searchUsers($filter, $attr = null, $limit = null, $offset = null) {
|
||||
return $this->search($filter, $this->connection->ldapBaseUsers, $attr, $limit, $offset);
|
||||
$result = [];
|
||||
foreach($this->connection->ldapBaseUsers as $base) {
|
||||
$result = array_merge($result, $this->search($filter, [$base], $attr, $limit, $offset));
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -986,7 +990,12 @@ class Access extends LDAPUtility {
|
|||
* @return false|int
|
||||
*/
|
||||
public function countUsers($filter, $attr = array('dn'), $limit = null, $offset = null) {
|
||||
return $this->count($filter, $this->connection->ldapBaseUsers, $attr, $limit, $offset);
|
||||
$result = false;
|
||||
foreach($this->connection->ldapBaseUsers as $base) {
|
||||
$count = $this->count($filter, [$base], $attr, $limit, $offset);
|
||||
$result = is_int($count) ? (int)$result + $count : $result;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1000,7 +1009,11 @@ class Access extends LDAPUtility {
|
|||
* Executes an LDAP search
|
||||
*/
|
||||
public function searchGroups($filter, $attr = null, $limit = null, $offset = null) {
|
||||
return $this->search($filter, $this->connection->ldapBaseGroups, $attr, $limit, $offset);
|
||||
$result = [];
|
||||
foreach($this->connection->ldapBaseGroups as $base) {
|
||||
$result = array_merge($result, $this->search($filter, [$base], $attr, $limit, $offset));
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1012,7 +1025,12 @@ class Access extends LDAPUtility {
|
|||
* @return int|bool
|
||||
*/
|
||||
public function countGroups($filter, $attr = array('dn'), $limit = null, $offset = null) {
|
||||
return $this->count($filter, $this->connection->ldapBaseGroups, $attr, $limit, $offset);
|
||||
$result = false;
|
||||
foreach($this->connection->ldapBaseGroups as $base) {
|
||||
$count = $this->count($filter, [$base], $attr, $limit, $offset);
|
||||
$result = is_int($count) ? (int)$result + $count : $result;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1023,7 +1041,12 @@ class Access extends LDAPUtility {
|
|||
* @return int|bool
|
||||
*/
|
||||
public function countObjects($limit = null, $offset = null) {
|
||||
return $this->count('objectclass=*', $this->connection->ldapBase, array('dn'), $limit, $offset);
|
||||
$result = false;
|
||||
foreach($this->connection->ldapBase as $base) {
|
||||
$count = $this->count('objectclass=*', [$base], ['dn'], $limit, $offset);
|
||||
$result = is_int($count) ? (int)$result + $count : $result;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue