Allow to sort groups by name

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2017-08-22 14:36:00 +02:00
parent 231cffffb9
commit 48bdb1bec1
No known key found for this signature in database
GPG Key ID: E166FD8976B3BAC8
2 changed files with 19 additions and 10 deletions

View File

@ -942,6 +942,11 @@ $CONFIG = array(
*/ */
'ldapUserCleanupInterval' => 51, 'ldapUserCleanupInterval' => 51,
/**
* Sort groups in the user settings by name instead of the user count
*/
'sort_groups_by_name' => false,
/** /**
* Comments * Comments
* *

View File

@ -45,19 +45,23 @@ $groupManager = \OC::$server->getGroupManager();
// Set the sort option: SORT_USERCOUNT or SORT_GROUPNAME // Set the sort option: SORT_USERCOUNT or SORT_GROUPNAME
$sortGroupsBy = \OC\Group\MetaData::SORT_USERCOUNT; $sortGroupsBy = \OC\Group\MetaData::SORT_USERCOUNT;
$isLDAPUsed = false; $config = \OC::$server->getConfig();
if (\OC_App::isEnabled('user_ldap')) {
$isLDAPUsed = if ($config->getSystemValue('sort_groups_by_name', false)) {
$groupManager->isBackendUsed('\OCA\User_LDAP\Group_LDAP') $sortGroupsBy = \OC\Group\MetaData::SORT_GROUPNAME;
|| $groupManager->isBackendUsed('\OCA\User_LDAP\Group_Proxy'); } else {
if ($isLDAPUsed) { $isLDAPUsed = false;
// LDAP user count can be slow, so we sort by group name here if (\OC_App::isEnabled('user_ldap')) {
$sortGroupsBy = \OC\Group\MetaData::SORT_GROUPNAME; $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()); $isAdmin = OC_User::isAdminUser(OC_User::getUser());
$isDisabled = !OC_User::isEnabled(OC_User::getUser()); $isDisabled = !OC_User::isEnabled(OC_User::getUser());