Skip to content

Commit

Permalink
Do not apply server side sorting for paged search requests
Browse files Browse the repository at this point in the history
Revert this prior start working on #10147

refs #10147
  • Loading branch information
Johannes Meyer committed Oct 1, 2015
1 parent 50e6681 commit 57f30b1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion library/Icinga/Protocol/Ldap/LdapConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ protected function runPagedQuery(LdapQuery $query, array $fields = null, $pageSi

$ds = $this->getConnection();

$serverSorting = $this->getCapabilities()->hasOid(LdapCapabilities::LDAP_SERVER_SORT_OID);
$serverSorting = false;//$this->getCapabilities()->hasOid(LdapCapabilities::LDAP_SERVER_SORT_OID);
if (! $serverSorting && $query->hasOrder()) {
foreach ($query->getOrder() as $rule) {
if (! in_array($rule[0], $fields)) {
Expand Down
2 changes: 1 addition & 1 deletion library/Icinga/Protocol/Ldap/LdapQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class LdapQuery extends SimpleQuery
protected function init()
{
$this->filters = array();
$this->usePagedResults = true;
$this->usePagedResults = false;
}

/**
Expand Down
20 changes: 14 additions & 6 deletions modules/setup/application/forms/AdminAccountPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,15 @@ protected function getUsername()
protected function fetchUsers()
{
try {
return $this
$query = $this
->createUserBackend()
->select(array('user_name'))
->order('user_name', 'asc', true)
->fetchColumn();
->order('user_name', 'asc', true);
if (in_array($this->backendConfig['backend'], array('ldap', 'msldap'))) {
$query->getQuery()->setUsePagedResults();
}

return $query->fetchColumn();
} catch (Exception $_) {
// No need to handle anything special here. Error means no users found.
return array();
Expand Down Expand Up @@ -346,10 +350,14 @@ protected function createUserBackend()
protected function fetchGroups()
{
try {
return $this
$query = $this
->createUserGroupBackend()
->select(array('group_name'))
->fetchColumn();
->select(array('group_name'));
if (in_array($this->backendConfig['backend'], array('ldap', 'msldap'))) {
$query->getQuery()->setUsePagedResults();
}

return $query->fetchColumn();
} catch (Exception $_) {
// No need to handle anything special here. Error means no groups found.
return array();
Expand Down

0 comments on commit 57f30b1

Please sign in to comment.