summaryrefslogtreecommitdiffstats
path: root/apps/provisioning_api/lib/Controller
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2019-01-17 11:59:05 +0100
committerArthur Schiwon <blizzz@arthur-schiwon.de>2019-01-17 11:59:15 +0100
commit4915d64de8d0ee862f0fdc92fe9bf856f3e8cbe1 (patch)
tree90a6ae7c6921c5d5fa1f16aafcb58c10da6e4c09 /apps/provisioning_api/lib/Controller
parentac6ee0b8b7d06deb5285b99ed55df5baae9d821f (diff)
downloadnextcloud-server-4915d64de8d0ee862f0fdc92fe9bf856f3e8cbe1.tar.gz
nextcloud-server-4915d64de8d0ee862f0fdc92fe9bf856f3e8cbe1.zip
ignore non existing users when retrieving details of group members
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/provisioning_api/lib/Controller')
-rw-r--r--apps/provisioning_api/lib/Controller/AUserData.php13
-rw-r--r--apps/provisioning_api/lib/Controller/GroupsController.php24
2 files changed, 26 insertions, 11 deletions
diff --git a/apps/provisioning_api/lib/Controller/AUserData.php b/apps/provisioning_api/lib/Controller/AUserData.php
index 864ed65e69e..780d4f7a761 100644
--- a/apps/provisioning_api/lib/Controller/AUserData.php
+++ b/apps/provisioning_api/lib/Controller/AUserData.php
@@ -23,6 +23,7 @@ namespace OCA\Provisioning_API\Controller;
use OC\Accounts\AccountManager;
use OC\User\Backend;
+use OC\User\NoUserException;
use OCP\AppFramework\OCS\OCSException;
use OCP\AppFramework\OCS\OCSNotFoundException;
use OCP\AppFramework\OCSController;
@@ -79,7 +80,9 @@ abstract class AUserData extends OCSController {
*
* @param string $userId
* @return array
+ * @throws NotFoundException
* @throws OCSException
+ * @throws OCSNotFoundException
*/
protected function getUserData(string $userId): array {
$currentLoggedInUser = $this->userSession->getUser();
@@ -111,9 +114,17 @@ abstract class AUserData extends OCSController {
$gids[] = $group->getGID();
}
+ try {
+ # might be thrown by LDAP due to handling of users disappears
+ # from the external source (reasons unknown to us)
+ # cf. https://github.com/nextcloud/server/issues/12991
+ $data['storageLocation'] = $targetUserObject->getHome();
+ } catch (NoUserException $e) {
+ throw new OCSNotFoundException($e->getMessage(), $e);
+ }
+
// Find the data
$data['id'] = $targetUserObject->getUID();
- $data['storageLocation'] = $targetUserObject->getHome();
$data['lastLogin'] = $targetUserObject->getLastLogin() * 1000;
$data['backend'] = $targetUserObject->getBackendClassName();
$data['subadmin'] = $this->getUserSubAdminGroupsData($targetUserObject->getUID());
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]);