1212
1313use InvalidArgumentException ;
1414use OC \Authentication \Token \RemoteWipe ;
15+ use OC \Group \DisplayNameCache as GroupDisplayNameCache ;
1516use OC \Group \Group ;
1617use OC \KnownUser \KnownUserService ;
1718use OC \User \Backend ;
5657/**
5758 * @psalm-import-type Provisioning_APIGroupDetails from ResponseDefinitions
5859 * @psalm-import-type Provisioning_APIUserDetails from ResponseDefinitions
60+ * @psalm-import-type Provisioning_APIUserDetailsGroupDisplayname from ResponseDefinitions
5961 */
6062class UsersController extends AUserDataOCSController {
6163
@@ -81,6 +83,7 @@ public function __construct(
8183 private IEventDispatcher $ eventDispatcher ,
8284 private IPhoneNumberUtil $ phoneNumberUtil ,
8385 private IAppManager $ appManager ,
86+ GroupDisplayNameCache $ groupDisplayNameCache ,
8487 ) {
8588 parent ::__construct (
8689 $ appName ,
@@ -93,6 +96,7 @@ public function __construct(
9396 $ subAdminManager ,
9497 $ l10nFactory ,
9598 $ rootFolder ,
99+ $ groupDisplayNameCache ,
96100 );
97101
98102 $ this ->l10n = $ l10nFactory ->get ($ appName );
@@ -146,7 +150,7 @@ public function getUsers(string $search = '', ?int $limit = null, int $offset =
146150 * @param string $search Text to search for
147151 * @param int|null $limit Limit the amount of groups returned
148152 * @param int $offset Offset for searching for groups
149- * @return DataResponse<Http::STATUS_OK, array{users: array<string, Provisioning_APIUserDetails|array{id: string}>}, array{}>
153+ * @return DataResponse<Http::STATUS_OK, array{users: array<string, Provisioning_APIUserDetails|array{id: string}>, groups: list<Provisioning_APIUserDetailsGroupDisplayname> }, array{}>
150154 *
151155 * 200: Users details returned
152156 */
@@ -198,7 +202,8 @@ public function getUsersDetails(string $search = '', ?int $limit = null, int $of
198202 }
199203
200204 return new DataResponse ([
201- 'users ' => $ usersDetails
205+ 'users ' => $ usersDetails ,
206+ 'groups ' => $ this ->findGroupsWithDisplayname ($ usersDetails ),
202207 ]);
203208 }
204209
0 commit comments