Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Make custom sort function to make sure users are sorted (fix #279)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Oct 11, 2013
1 parent 3554958 commit e90e632
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion core/src/plugins/auth.ldap/class.ldapAuthDriver.php
Expand Up @@ -274,6 +274,9 @@ function getUserEntries($login = null, $countOnly = false, $offset = -1, $limit
if(!empty($entries["count"])){
$allEntries["count"] += $entries["count"];
unset($entries["count"]);
if($limit != -1){
usort($entries, array($this, "userSortFunction"));
}
foreach($entries as $entry){
if($offset != -1 && $index < $offset){
$index ++; continue;
Expand All @@ -287,7 +290,13 @@ function getUserEntries($login = null, $countOnly = false, $offset = -1, $limit
return $allEntries;
}

function supportsUsersPagination(){
private function userSortFunction($entryA, $entryB)
{
return strcasecmp($entryA[$this->ldapUserAttr][0], $entryB[$this->ldapUserAttr][0]);
}

public function supportsUsersPagination()
{
return true;
}
function listUsersPaginated($baseGroup="/", $regexp, $offset, $limit){
Expand Down

0 comments on commit e90e632

Please sign in to comment.