Skip to content
Snippets Groups Projects
Commit 61598e7b authored by Vincent Petry's avatar Vincent Petry
Browse files

Merge pull request #9751 from owncloud/issue/9748

Fix username for subadmins and only send subadmin groups
parents 3df7a83c 0dc67cb1
Branches
No related tags found
No related merge requests found
......@@ -38,9 +38,7 @@ $adminGroups = array();
$groupManager = \OC_Group::getManager();
$isAdmin = OC_User::isAdminUser(OC_User::getUser());
//we pass isAdmin as true, because OC_SubAdmin has no search feature,
//groups will be filtered out later
$groupsInfo = new \OC\Group\MetaData(OC_User::getUser(), true, $groupManager);
$groupsInfo = new \OC\Group\MetaData(OC_User::getUser(), $isAdmin, $groupManager);
$groupsInfo->setSorting($groupsInfo::SORT_USERCOUNT);
list($adminGroups, $groups) = $groupsInfo->get($groupPattern, $pattern);
......
......@@ -76,10 +76,13 @@ if (OC_User::isAdminUser(OC_User::getUser())) {
$batch = OC_Group::usersInGroups($groups, $pattern, $limit, $offset);
foreach ($batch as $uid) {
$user = $userManager->get($uid);
// Only add the groups, this user is a subadmin of
$userGroups = array_intersect(OC_Group::getUserGroups($uid), OC_SubAdmin::getSubAdminsGroups(OC_User::getUser()));
$users[] = array(
'name' => $user,
'name' => $uid,
'displayname' => $user->getDisplayName(),
'groups' => join(', ', OC_Group::getUserGroups($uid)),
'groups' => join(', ', $userGroups),
'quota' => OC_Preferences::getValue($uid, 'files', 'quota', 'default'),
'storageLocation' => $user->getHome(),
'lastLogin' => $user->getLastLogin(),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment