Merge pull request #9751 from owncloud/issue/9748
Fix username for subadmins and only send subadmin groups
This commit is contained in:
commit
61598e7bb5
|
@ -38,9 +38,7 @@ $adminGroups = array();
|
||||||
$groupManager = \OC_Group::getManager();
|
$groupManager = \OC_Group::getManager();
|
||||||
$isAdmin = OC_User::isAdminUser(OC_User::getUser());
|
$isAdmin = OC_User::isAdminUser(OC_User::getUser());
|
||||||
|
|
||||||
//we pass isAdmin as true, because OC_SubAdmin has no search feature,
|
$groupsInfo = new \OC\Group\MetaData(OC_User::getUser(), $isAdmin, $groupManager);
|
||||||
//groups will be filtered out later
|
|
||||||
$groupsInfo = new \OC\Group\MetaData(OC_User::getUser(), true, $groupManager);
|
|
||||||
$groupsInfo->setSorting($groupsInfo::SORT_USERCOUNT);
|
$groupsInfo->setSorting($groupsInfo::SORT_USERCOUNT);
|
||||||
list($adminGroups, $groups) = $groupsInfo->get($groupPattern, $pattern);
|
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);
|
$batch = OC_Group::usersInGroups($groups, $pattern, $limit, $offset);
|
||||||
foreach ($batch as $uid) {
|
foreach ($batch as $uid) {
|
||||||
$user = $userManager->get($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(
|
$users[] = array(
|
||||||
'name' => $user,
|
'name' => $uid,
|
||||||
'displayname' => $user->getDisplayName(),
|
'displayname' => $user->getDisplayName(),
|
||||||
'groups' => join(', ', OC_Group::getUserGroups($uid)),
|
'groups' => join(', ', $userGroups),
|
||||||
'quota' => OC_Preferences::getValue($uid, 'files', 'quota', 'default'),
|
'quota' => OC_Preferences::getValue($uid, 'files', 'quota', 'default'),
|
||||||
'storageLocation' => $user->getHome(),
|
'storageLocation' => $user->getHome(),
|
||||||
'lastLogin' => $user->getLastLogin(),
|
'lastLogin' => $user->getLastLogin(),
|
||||||
|
|
Loading…
Reference in New Issue