diff options
author | Joas Schilling <coding@schilljs.com> | 2017-08-22 15:36:00 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2017-08-22 15:36:00 +0300 |
commit | 48bdb1bec19e683a385116f278ed5d28faa303b0 (patch) | |
tree | abd0690f76bd6a760cc544846f18b44d1c0fe6a5 | |
parent | 231cffffb9084ed1b7779f40ec07ad617ec71a30 (diff) |
Allow to sort groups by name
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r-- | config/config.sample.php | 5 | ||||
-rw-r--r-- | settings/users.php | 24 |
2 files changed, 19 insertions, 10 deletions
diff --git a/config/config.sample.php b/config/config.sample.php index 9f6ef668c5e..9735847c0e3 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -943,6 +943,11 @@ $CONFIG = array( 'ldapUserCleanupInterval' => 51, /** + * Sort groups in the user settings by name instead of the user count + */ +'sort_groups_by_name' => false, + +/** * Comments * * Global settings for the Comments infrastructure diff --git a/settings/users.php b/settings/users.php index 8dedb703ada..76c6b5848eb 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()); |