diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-05-06 16:07:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-06 16:07:52 +0200 |
commit | bf017c3c5d59fc0423d2b096d85bc14f73ec4a0c (patch) | |
tree | f16f6e34e398c45194abbcccdc2d19018d8658e4 /apps | |
parent | afe8b9b1f1ca994274483723a4e63876065a6b5a (diff) | |
parent | e524bf3e8543cf37017e60836d5106c9d1292dc6 (diff) | |
download | nextcloud-server-bf017c3c5d59fc0423d2b096d85bc14f73ec4a0c.tar.gz nextcloud-server-bf017c3c5d59fc0423d2b096d85bc14f73ec4a0c.zip |
Merge pull request #44984 from nextcloud/backport/44982/stable28
[stable28] fix(provisioning_api): Show warning but do not fail when listing accounts in case of users removed from backend but still in database
Diffstat (limited to 'apps')
-rw-r--r-- | apps/provisioning_api/lib/Controller/UsersController.php | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/apps/provisioning_api/lib/Controller/UsersController.php b/apps/provisioning_api/lib/Controller/UsersController.php index 2a7830cda8f..24ac097f6bb 100644 --- a/apps/provisioning_api/lib/Controller/UsersController.php +++ b/apps/provisioning_api/lib/Controller/UsersController.php @@ -57,6 +57,7 @@ use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\OCS\OCSException; use OCP\AppFramework\OCS\OCSForbiddenException; +use OCP\AppFramework\OCS\OCSNotFoundException; use OCP\AppFramework\OCSController; use OCP\EventDispatcher\IEventDispatcher; use OCP\HintException; @@ -214,7 +215,14 @@ class UsersController extends AUserData { $usersDetails = []; foreach ($users as $userId) { $userId = (string) $userId; - $userData = $this->getUserData($userId); + try { + $userData = $this->getUserData($userId); + } catch (OCSNotFoundException $e) { + // We still want to return all other accounts, but this one was removed from the backends + // yet they are still in our database. Might be a LDAP remnant. + $userData = null; + $this->logger->warning('Found one enabled account that is removed from its backend, but still exists in Nextcloud database', ['accountId' => $userId]); + } // Do not insert empty entry if ($userData !== null) { $usersDetails[$userId] = $userData; @@ -287,12 +295,19 @@ class UsersController extends AUserData { $usersDetails = []; foreach ($users as $userId) { - $userData = $this->getUserData($userId); + try { + $userData = $this->getUserData($userId); + } catch (OCSNotFoundException $e) { + // We still want to return all other accounts, but this one was removed from the backends + // yet they are still in our database. Might be a LDAP remnant. + $userData = null; + $this->logger->warning('Found one disabled account that was removed from its backend, but still exists in Nextcloud database', ['accountId' => $userId]); + } // Do not insert empty entry if ($userData !== null) { $usersDetails[$userId] = $userData; } else { - // Logged user does not have permissions to see this user + // Currently logged in user does not have permissions to see this user // only showing its id $usersDetails[$userId] = ['id' => $userId]; } |