summaryrefslogtreecommitdiffstats
path: root/settings/Controller/UsersController.php
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-05-24 11:29:48 +0200
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-05-24 17:52:15 +0200
commitc55cf79453a91bbe58759c3188060c9e620e8f62 (patch)
tree8f498754e0173a96698c5a175e3c0804f87e00ab /settings/Controller/UsersController.php
parentddd1c8bc8689017559f6d6af36898fb7ddb28adb (diff)
downloadnextcloud-server-c55cf79453a91bbe58759c3188060c9e620e8f62.tar.gz
nextcloud-server-c55cf79453a91bbe58759c3188060c9e620e8f62.zip
Added total count for subadmins
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'settings/Controller/UsersController.php')
-rw-r--r--settings/Controller/UsersController.php13
1 files changed, 7 insertions, 6 deletions
diff --git a/settings/Controller/UsersController.php b/settings/Controller/UsersController.php
index 3da764a8270..f19efefbb68 100644
--- a/settings/Controller/UsersController.php
+++ b/settings/Controller/UsersController.php
@@ -193,21 +193,22 @@ class UsersController extends Controller {
}, 0);
} else {
// User is subadmin !
- // TODO We can't have the total user count per groups, disabling it
- $userCount = false;
- $groupsNames = [];
// Map group list to names to retrieve the countDisabledUsersOfGroups
- $userGroups = $this->groupManager->getUserGroupIds($user);
+ $userGroups = $this->groupManager->getUserGroups($user);
+ $groupsNames = [];
+ $userCount = 0;
foreach($groups as $key => $group) {
// $userCount += (int)$group['usercount'];
array_push($groupsNames, $group['name']);
// we prevent subadmins from looking up themselves
// so we lower the count of the groups he belongs to
- if (in_array($group['id'], $userGroups)) {
+ if (array_key_exists($group['id'], $userGroups)) {
$groups[$key]['usercount']--;
+ $userCount = -1; // we also lower from one the total count
}
};
+ $userCount += $this->userManager->countUsersOfGroups($groupsInfo->getGroups());
$disabledUsers = $isLDAPUsed ? 0 : $this->userManager->countDisabledUsersOfGroups($groupsNames);
}
$disabledUsersGroup = [
@@ -238,7 +239,7 @@ class UsersController extends Controller {
$serverData['isAdmin'] = $this->isAdmin;
$serverData['sortGroups'] = $sortGroupsBy;
$serverData['quotaPreset'] = $quotaPreset;
- $serverData['userCount'] = $userCount === false ? false : $userCount - $disabledUsers;
+ $serverData['userCount'] = $userCount - $disabledUsers;
$serverData['languages'] = $languages;
$serverData['defaultLanguage'] = $this->config->getSystemValue('default_language', 'en');
// Settings