From a851a5f244fae81b5eefa36f322fded6841410bd Mon Sep 17 00:00:00 2001 From: fogelito Date: Wed, 21 Feb 2024 11:43:04 +0200 Subject: [PATCH 1/2] providerInternalId nulls --- app/controllers/api/users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index 55ad758637..5185d7eba5 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -514,7 +514,7 @@ App::post('/v1/users/:userId/targets') Permission::delete(Role::user($user->getId())), ], 'providerId' => $providerId ?? null, - 'providerInternalId' => $provider->getInternalId() ?? null, + 'providerInternalId' => $provider->isEmpty() ? null : $provider->getInternalId(), 'providerType' => $providerType, 'userId' => $userId, 'userInternalId' => $user->getInternalId(), From b762a9cedd142c3a255c65cd6d9c6d08c1614586 Mon Sep 17 00:00:00 2001 From: fogelito Date: Wed, 21 Feb 2024 11:48:16 +0200 Subject: [PATCH 2/2] Check user false --- app/controllers/api/users.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index 5185d7eba5..0a9fbbc40e 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -1660,7 +1660,7 @@ App::post('/v1/users/:userId/sessions') ->inject('queueForEvents') ->action(function (string $userId, Request $request, Response $response, Database $dbForProject, Document $project, Locale $locale, Reader $geodb, Event $queueForEvents) { $user = $dbForProject->getDocument('users', $userId); - if ($user === false || $user->isEmpty()) { + if ($user->isEmpty()) { throw new Exception(Exception::USER_NOT_FOUND); } @@ -1729,7 +1729,7 @@ App::post('/v1/users/:userId/tokens') ->action(function (string $userId, int $length, int $expire, Request $request, Response $response, Database $dbForProject, Event $queueForEvents) { $user = $dbForProject->getDocument('users', $userId); - if ($user === false || $user->isEmpty()) { + if ($user->isEmpty()) { throw new Exception(Exception::USER_NOT_FOUND); }