From 4915d64de8d0ee862f0fdc92fe9bf856f3e8cbe1 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Thu, 17 Jan 2019 11:59:05 +0100 Subject: ignore non existing users when retrieving details of group members Signed-off-by: Arthur Schiwon --- .../lib/Controller/GroupsController.php | 24 +++++++++++++--------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'apps/provisioning_api/lib/Controller/GroupsController.php') diff --git a/apps/provisioning_api/lib/Controller/GroupsController.php b/apps/provisioning_api/lib/Controller/GroupsController.php index e52929df9c6..7c4447ac4eb 100644 --- a/apps/provisioning_api/lib/Controller/GroupsController.php +++ b/apps/provisioning_api/lib/Controller/GroupsController.php @@ -203,16 +203,20 @@ class GroupsController extends AUserData { // Extract required number $usersDetails = []; foreach ($users as $user) { - /** @var IUser $user */ - $userId = (string) $user->getUID(); - $userData = $this->getUserData($userId); - // Do not insert empty entry - if(!empty($userData)) { - $usersDetails[$userId] = $userData; - } else { - // Logged user does not have permissions to see this user - // only showing its id - $usersDetails[$userId] = ['id' => $userId]; + try { + /** @var IUser $user */ + $userId = (string)$user->getUID(); + $userData = $this->getUserData($userId); + // Do not insert empty entry + if (!empty($userData)) { + $usersDetails[$userId] = $userData; + } else { + // Logged user does not have permissions to see this user + // only showing its id + $usersDetails[$userId] = ['id' => $userId]; + } + } catch(OCSNotFoundException $e) { + // continue if a users ceased to exist. } } return new DataResponse(['users' => $usersDetails]); -- cgit v1.2.3