Skip to content

Commit 24c1eb3

Browse files
Merge pull request #62206 from nextcloud/revert-group-display-name-fix-stable32
[stable32] Revert group display name fix
2 parents 14c2432 + aaa40b2 commit 24c1eb3

13 files changed

Lines changed: 30 additions & 358 deletions

apps/provisioning_api/lib/Controller/AUserDataOCSController.php

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
*/
99
namespace OCA\Provisioning_API\Controller;
1010

11-
use OC\Group\DisplayNameCache as GroupDisplayNameCache;
1211
use OC\Group\Manager as GroupManager;
1312
use OC\User\Backend;
1413
use OC\User\NoUserException;
@@ -36,7 +35,6 @@
3635

3736
/**
3837
* @psalm-import-type Provisioning_APIUserDetails from ResponseDefinitions
39-
* @psalm-import-type Provisioning_APIUserDetailsGroupDisplayname from ResponseDefinitions
4038
* @psalm-import-type Provisioning_APIUserDetailsQuota from ResponseDefinitions
4139
*/
4240
abstract class AUserDataOCSController extends OCSController {
@@ -63,7 +61,6 @@ public function __construct(
6361
protected ISubAdmin $subAdminManager,
6462
protected IFactory $l10nFactory,
6563
protected IRootFolder $rootFolder,
66-
private GroupDisplayNameCache $groupDisplayNameCache,
6764
) {
6865
parent::__construct($appName, $request);
6966
}
@@ -255,35 +252,6 @@ protected function getUserSubAdminGroupsData(string $userId): array {
255252
return $groups;
256253
}
257254

258-
/**
259-
* A full group has id, name, usercount, disabled, canAdd and canRemove. Only
260-
* the displayname is cached; usercount/disabled are not cached. So this only
261-
* returns an {id, displayname} skeleton instead of the full group.
262-
*
263-
* @param array<string, Provisioning_APIUserDetails|array{id: string}> $userDetails
264-
* @return list<Provisioning_APIUserDetailsGroupDisplayname>
265-
*/
266-
protected function findGroupsWithDisplayname(array $userDetails): array {
267-
$groupIds = [];
268-
269-
foreach ($userDetails as $userDetail) {
270-
if (isset($userDetail['groups'])) {
271-
array_push($groupIds, ...array_values($userDetail['groups']));
272-
}
273-
if (isset($userDetail['subadmin'])) {
274-
array_push($groupIds, ...array_values($userDetail['subadmin']));
275-
}
276-
}
277-
278-
$groupIds = array_unique($groupIds);
279-
sort($groupIds);
280-
281-
return array_map(function ($groupId) {
282-
$displayname = $this->groupDisplayNameCache->getDisplayName($groupId) ?? $groupId;
283-
return ['id' => $groupId, 'displayname' => $displayname];
284-
}, $groupIds);
285-
}
286-
287255
/**
288256
* @param IUser $user
289257
* @return Provisioning_APIUserDetailsQuota

apps/provisioning_api/lib/Controller/GroupsController.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
*/
99
namespace OCA\Provisioning_API\Controller;
1010

11-
use OC\Group\DisplayNameCache as GroupDisplayNameCache;
1211
use OCA\Provisioning_API\ResponseDefinitions;
1312
use OCA\Settings\Settings\Admin\Sharing;
1413
use OCA\Settings\Settings\Admin\Users;
@@ -37,7 +36,6 @@
3736
/**
3837
* @psalm-import-type Provisioning_APIGroupDetails from ResponseDefinitions
3938
* @psalm-import-type Provisioning_APIUserDetails from ResponseDefinitions
40-
* @psalm-import-type Provisioning_APIUserDetailsGroupDisplayname from ResponseDefinitions
4139
*/
4240
class GroupsController extends AUserDataOCSController {
4341

@@ -53,7 +51,6 @@ public function __construct(
5351
IFactory $l10nFactory,
5452
IRootFolder $rootFolder,
5553
private LoggerInterface $logger,
56-
GroupDisplayNameCache $groupDisplayNameCache,
5754
) {
5855
parent::__construct($appName,
5956
$request,
@@ -65,7 +62,6 @@ public function __construct(
6562
$subAdminManager,
6663
$l10nFactory,
6764
$rootFolder,
68-
$groupDisplayNameCache,
6965
);
7066
}
7167

@@ -190,7 +186,7 @@ public function getGroupUsers(string $groupId): DataResponse {
190186
* @param int|null $limit Limit the amount of groups returned
191187
* @param int $offset Offset for searching for groups
192188
*
193-
* @return DataResponse<Http::STATUS_OK, array{users: array<string, Provisioning_APIUserDetails|array{id: string}>, groups: list<Provisioning_APIUserDetailsGroupDisplayname>}, array{}>
189+
* @return DataResponse<Http::STATUS_OK, array{users: array<string, Provisioning_APIUserDetails|array{id: string}>}, array{}>
194190
* @throws OCSException
195191
*
196192
* 200: Group users details returned
@@ -233,10 +229,7 @@ public function getGroupUsersDetails(string $groupId, string $search = '', ?int
233229
// continue if a users ceased to exist.
234230
}
235231
}
236-
return new DataResponse([
237-
'users' => $usersDetails,
238-
'groups' => $this->findGroupsWithDisplayname($usersDetails),
239-
]);
232+
return new DataResponse(['users' => $usersDetails]);
240233
}
241234

242235
throw new OCSException('The requested group could not be found', OCSController::RESPOND_NOT_FOUND);

apps/provisioning_api/lib/Controller/UsersController.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
use InvalidArgumentException;
1414
use OC\Authentication\Token\RemoteWipe;
15-
use OC\Group\DisplayNameCache as GroupDisplayNameCache;
1615
use OC\Group\Group;
1716
use OC\KnownUser\KnownUserService;
1817
use OC\User\Backend;
@@ -57,7 +56,6 @@
5756
/**
5857
* @psalm-import-type Provisioning_APIGroupDetails from ResponseDefinitions
5958
* @psalm-import-type Provisioning_APIUserDetails from ResponseDefinitions
60-
* @psalm-import-type Provisioning_APIUserDetailsGroupDisplayname from ResponseDefinitions
6159
*/
6260
class UsersController extends AUserDataOCSController {
6361

@@ -83,7 +81,6 @@ public function __construct(
8381
private IEventDispatcher $eventDispatcher,
8482
private IPhoneNumberUtil $phoneNumberUtil,
8583
private IAppManager $appManager,
86-
GroupDisplayNameCache $groupDisplayNameCache,
8784
) {
8885
parent::__construct(
8986
$appName,
@@ -96,7 +93,6 @@ public function __construct(
9693
$subAdminManager,
9794
$l10nFactory,
9895
$rootFolder,
99-
$groupDisplayNameCache,
10096
);
10197

10298
$this->l10n = $l10nFactory->get($appName);
@@ -150,7 +146,7 @@ public function getUsers(string $search = '', ?int $limit = null, int $offset =
150146
* @param string $search Text to search for
151147
* @param int|null $limit Limit the amount of groups returned
152148
* @param int $offset Offset for searching for groups
153-
* @return DataResponse<Http::STATUS_OK, array{users: array<string, Provisioning_APIUserDetails|array{id: string}>, groups: list<Provisioning_APIUserDetailsGroupDisplayname>}, array{}>
149+
* @return DataResponse<Http::STATUS_OK, array{users: array<string, Provisioning_APIUserDetails|array{id: string}>}, array{}>
154150
*
155151
* 200: Users details returned
156152
*/
@@ -202,8 +198,7 @@ public function getUsersDetails(string $search = '', ?int $limit = null, int $of
202198
}
203199

204200
return new DataResponse([
205-
'users' => $usersDetails,
206-
'groups' => $this->findGroupsWithDisplayname($usersDetails),
201+
'users' => $usersDetails
207202
]);
208203
}
209204

apps/provisioning_api/lib/ResponseDefinitions.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@
2020
*
2121
* @psalm-type Provisioning_APIUserDetailsScope = 'v2-private'|'v2-local'|'v2-federated'|'v2-published'
2222
*
23-
* @psalm-type Provisioning_APIUserDetailsGroupDisplayname = array{
24-
* id: string,
25-
* displayname: string,
26-
* }
27-
*
2823
* @psalm-type Provisioning_APIUserDetails = array{
2924
* additional_mail: list<string>,
3025
* additional_mailScope?: list<Provisioning_APIUserDetailsScope>,

apps/provisioning_api/openapi-full.json

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -333,21 +333,6 @@
333333
}
334334
}
335335
},
336-
"UserDetailsGroupDisplayname": {
337-
"type": "object",
338-
"required": [
339-
"id",
340-
"displayname"
341-
],
342-
"properties": {
343-
"id": {
344-
"type": "string"
345-
},
346-
"displayname": {
347-
"type": "string"
348-
}
349-
}
350-
},
351336
"UserDetailsQuota": {
352337
"type": "object",
353338
"properties": {
@@ -3541,8 +3526,7 @@
35413526
"data": {
35423527
"type": "object",
35433528
"required": [
3544-
"users",
3545-
"groups"
3529+
"users"
35463530
],
35473531
"properties": {
35483532
"users": {
@@ -3565,12 +3549,6 @@
35653549
}
35663550
]
35673551
}
3568-
},
3569-
"groups": {
3570-
"type": "array",
3571-
"items": {
3572-
"$ref": "#/components/schemas/UserDetailsGroupDisplayname"
3573-
}
35743552
}
35753553
}
35763554
}
@@ -4013,8 +3991,7 @@
40133991
"data": {
40143992
"type": "object",
40153993
"required": [
4016-
"users",
4017-
"groups"
3994+
"users"
40183995
],
40193996
"properties": {
40203997
"users": {
@@ -4037,12 +4014,6 @@
40374014
}
40384015
]
40394016
}
4040-
},
4041-
"groups": {
4042-
"type": "array",
4043-
"items": {
4044-
"$ref": "#/components/schemas/UserDetailsGroupDisplayname"
4045-
}
40464017
}
40474018
}
40484019
}

apps/provisioning_api/openapi.json

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -333,21 +333,6 @@
333333
}
334334
}
335335
},
336-
"UserDetailsGroupDisplayname": {
337-
"type": "object",
338-
"required": [
339-
"id",
340-
"displayname"
341-
],
342-
"properties": {
343-
"id": {
344-
"type": "string"
345-
},
346-
"displayname": {
347-
"type": "string"
348-
}
349-
}
350-
},
351336
"UserDetailsQuota": {
352337
"type": "object",
353338
"properties": {
@@ -945,8 +930,7 @@
945930
"data": {
946931
"type": "object",
947932
"required": [
948-
"users",
949-
"groups"
933+
"users"
950934
],
951935
"properties": {
952936
"users": {
@@ -969,12 +953,6 @@
969953
}
970954
]
971955
}
972-
},
973-
"groups": {
974-
"type": "array",
975-
"items": {
976-
"$ref": "#/components/schemas/UserDetailsGroupDisplayname"
977-
}
978956
}
979957
}
980958
}
@@ -1528,8 +1506,7 @@
15281506
"data": {
15291507
"type": "object",
15301508
"required": [
1531-
"users",
1532-
"groups"
1509+
"users"
15331510
],
15341511
"properties": {
15351512
"users": {
@@ -1552,12 +1529,6 @@
15521529
}
15531530
]
15541531
}
1555-
},
1556-
"groups": {
1557-
"type": "array",
1558-
"items": {
1559-
"$ref": "#/components/schemas/UserDetailsGroupDisplayname"
1560-
}
15611532
}
15621533
}
15631534
}

0 commit comments

Comments
 (0)