diff options
author | Joas Schilling <nickvergessen@owncloud.com> | 2015-06-11 17:57:00 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@owncloud.com> | 2015-06-16 11:10:00 +0200 |
commit | 171f86ca2e71918809930e823062d93c03833921 (patch) | |
tree | f605b2fa0d94a78c44d9781c595331f1e8a34b52 /settings/users.php | |
parent | fee62ac61c1cecb37e283fc6f9faf0251389226f (diff) | |
download | nextcloud-server-171f86ca2e71918809930e823062d93c03833921.tar.gz nextcloud-server-171f86ca2e71918809930e823062d93c03833921.zip |
Only sort by group name when LDAP is involved
Diffstat (limited to 'settings/users.php')
-rw-r--r-- | settings/users.php | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/settings/users.php b/settings/users.php index 44e2548be72..5da6902b8fa 100644 --- a/settings/users.php +++ b/settings/users.php @@ -37,12 +37,25 @@ OC_App::setActiveNavigationEntry( 'core_users' ); $userManager = \OC_User::getManager(); $groupManager = \OC_Group::getManager(); +// Set the sort option: SORT_USERCOUNT or SORT_GROUPNAME +$sortGroupsBy = \OC\Group\MetaData::SORT_USERCOUNT; + +if (class_exists('\OCA\user_ldap\GROUP_LDAP')) { + $backends = $groupManager->getBackends(); + foreach ($backends as $backend) { + if ($backend instanceof \OCA\user_ldap\GROUP_LDAP) { + // LDAP user count can be slow, so we sort by gorup name here + $sortGroupsBy = \OC\Group\MetaData::SORT_GROUPNAME; + } + } +} + $config = \OC::$server->getConfig(); $isAdmin = OC_User::isAdminUser(OC_User::getUser()); $groupsInfo = new \OC\Group\MetaData(OC_User::getUser(), $isAdmin, $groupManager); -$groupsInfo->setSorting($groupsInfo::SORT_GROUPNAME); +$groupsInfo->setSorting($sortGroupsBy); list($adminGroup, $groups) = $groupsInfo->get(); $recoveryAdminEnabled = OC_App::isEnabled('encryption') && @@ -75,6 +88,7 @@ $defaultQuotaIsUserDefined=array_search($defaultQuota, $quotaPreset)===false $tmpl = new OC_Template("settings", "users/main", "user"); $tmpl->assign('groups', $groups); +$tmpl->assign('sortGroups', $sortGroupsBy); $tmpl->assign('adminGroup', $adminGroup); $tmpl->assign('isAdmin', (int)$isAdmin); $tmpl->assign('subadmins', $subadmins); |