summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-02-27 02:39:22 -0800
committerBernhard Posselt <nukeawhale@gmail.com>2013-02-27 02:39:22 -0800
commita54be4acc482465253d84fe35d2d666b32da02d1 (patch)
tree82d8dfa97696bb47b378a9d1753f5fd026b82bc8
parent58b06c5c9a8b49b1db9c696b2f46595f229bb729 (diff)
parent60d4fdda5780ea115ae4d051165256ce7de69783 (diff)
downloadnextcloud-server-a54be4acc482465253d84fe35d2d666b32da02d1.tar.gz
nextcloud-server-a54be4acc482465253d84fe35d2d666b32da02d1.zip
Merge pull request #1948 from owncloud/improve_user_sorting
Sort after display name + LDAP server side sorting
-rw-r--r--apps/user_ldap/lib/access.php11
-rw-r--r--lib/user.php2
-rw-r--r--settings/js/users.js4
3 files changed, 13 insertions, 4 deletions
diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php
index 901299e7c21..05249b8f163 100644
--- a/apps/user_ldap/lib/access.php
+++ b/apps/user_ldap/lib/access.php
@@ -624,7 +624,8 @@ abstract class Access {
* @brief executes an LDAP search
* @param $filter the LDAP filter for the search
* @param $base an array containing the LDAP subtree(s) that shall be searched
- * @param $attr optional, when a certain attribute shall be filtered out
+ * @param $attr optional, array, one or more attributes that shall be
+ * retrieved. Results will according to the order in the array.
* @returns array with the search result
*
* Executes an LDAP search
@@ -656,6 +657,14 @@ abstract class Access {
\OCP\Util::writeLog('user_ldap', 'Attempt for Paging? '.print_r($pagedSearchOK, true), \OCP\Util::ERROR);
return array();
}
+
+ // Do the server-side sorting
+ foreach(array_reverse($attr) as $sortAttr){
+ foreach($sr as $searchResource) {
+ ldap_sort($link_resource, $searchResource, $sortAttr);
+ }
+ }
+
$findings = array();
foreach($sr as $key => $res) {
$findings = array_merge($findings, ldap_get_entries($link_resource, $res ));
diff --git a/lib/user.php b/lib/user.php
index f84aa8fad83..6144f0f6bf9 100644
--- a/lib/user.php
+++ b/lib/user.php
@@ -530,7 +530,7 @@ class OC_User {
$displayNames = array_merge($displayNames, $backendDisplayNames);
}
}
- ksort($displayNames);
+ asort($displayNames);
return $displayNames;
}
diff --git a/settings/js/users.js b/settings/js/users.js
index 452bdf5f838..2c27c6d7666 100644
--- a/settings/js/users.js
+++ b/settings/js/users.js
@@ -116,9 +116,9 @@ var UserList = {
}
var added = false;
if (sort) {
- username = username.toLowerCase();
+ displayname = displayname.toLowerCase();
$('tbody tr').each(function () {
- if (username < $(this).attr('data-uid').toLowerCase()) {
+ if (displayname < $(this).attr('data-uid').toLowerCase()) {
$(tr).insertBefore($(this));
added = true;
return false;