From 48bdb1bec19e683a385116f278ed5d28faa303b0 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 22 Aug 2017 14:36:00 +0200 Subject: [PATCH] Allow to sort groups by name Signed-off-by: Joas Schilling --- config/config.sample.php | 5 +++++ settings/users.php | 24 ++++++++++++++---------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/config/config.sample.php b/config/config.sample.php index 9f6ef668c5..9735847c0e 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -942,6 +942,11 @@ $CONFIG = array( */ 'ldapUserCleanupInterval' => 51, +/** + * Sort groups in the user settings by name instead of the user count + */ +'sort_groups_by_name' => false, + /** * Comments * diff --git a/settings/users.php b/settings/users.php index 8dedb703ad..76c6b5848e 100644 --- a/settings/users.php +++ b/settings/users.php @@ -45,19 +45,23 @@ $groupManager = \OC::$server->getGroupManager(); // Set the sort option: SORT_USERCOUNT or SORT_GROUPNAME $sortGroupsBy = \OC\Group\MetaData::SORT_USERCOUNT; -$isLDAPUsed = false; -if (\OC_App::isEnabled('user_ldap')) { - $isLDAPUsed = - $groupManager->isBackendUsed('\OCA\User_LDAP\Group_LDAP') - || $groupManager->isBackendUsed('\OCA\User_LDAP\Group_Proxy'); - if ($isLDAPUsed) { - // LDAP user count can be slow, so we sort by group name here - $sortGroupsBy = \OC\Group\MetaData::SORT_GROUPNAME; +$config = \OC::$server->getConfig(); + +if ($config->getSystemValue('sort_groups_by_name', false)) { + $sortGroupsBy = \OC\Group\MetaData::SORT_GROUPNAME; +} else { + $isLDAPUsed = false; + if (\OC_App::isEnabled('user_ldap')) { + $isLDAPUsed = + $groupManager->isBackendUsed('\OCA\User_LDAP\Group_LDAP') + || $groupManager->isBackendUsed('\OCA\User_LDAP\Group_Proxy'); + if ($isLDAPUsed) { + // LDAP user count can be slow, so we sort by group name here + $sortGroupsBy = \OC\Group\MetaData::SORT_GROUPNAME; + } } } -$config = \OC::$server->getConfig(); - $isAdmin = OC_User::isAdminUser(OC_User::getUser()); $isDisabled = !OC_User::isEnabled(OC_User::getUser());