diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index b3ae17dc91..9163db0588 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -643,15 +643,20 @@ App::get('/v1/users') $cursor->setValue($cursorDocument); } - $filterQueries = Query::groupByType($queries)['filters']; - try { - $users = $dbForProject->find('users', $queries); - $total = $dbForProject->count('users', $filterQueries, APP_LIMIT_COUNT); - } catch (OrderException $e) { - throw new Exception(Exception::DATABASE_QUERY_ORDER_NULL, "The order attribute '{$e->getAttribute()}' had a null value. Cursor pagination requires all documents order attribute values are non-null."); - } catch (QueryException $e) { - throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); - } + $users = []; + $total = 0; + + $dbForProject->skipFilters(function () use ($dbForProject, $queries, &$users, &$total) { + try { + $users = $dbForProject->find('users', $queries); + $total = $dbForProject->count('users', $queries, APP_LIMIT_COUNT); + } catch (OrderException $e) { + throw new Exception(Exception::DATABASE_QUERY_ORDER_NULL, "The order attribute '{$e->getAttribute()}' had a null value. Cursor pagination requires all documents order attribute values are non-null."); + } catch (QueryException $e) { + throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); + } + }, ['subQueryAuthenticators', 'subQuerySessions', 'subQueryTokens', 'subQueryChallenges', 'subQueryMemberships']); + $response->dynamic(new Document([ 'users' => $users, 'total' => $total, diff --git a/composer.lock b/composer.lock index aa8fd0ab90..c659e066c1 100644 --- a/composer.lock +++ b/composer.lock @@ -3545,16 +3545,16 @@ }, { "name": "utopia-php/database", - "version": "0.71.12", + "version": "0.71.13", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "72c2a9c185f0f606e4792913a071f744cca21d42" + "reference": "43aaba72b5699a06351b25924c3417ff83e6bb4b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/72c2a9c185f0f606e4792913a071f744cca21d42", - "reference": "72c2a9c185f0f606e4792913a071f744cca21d42", + "url": "https://api.github.com/repos/utopia-php/database/zipball/43aaba72b5699a06351b25924c3417ff83e6bb4b", + "reference": "43aaba72b5699a06351b25924c3417ff83e6bb4b", "shasum": "" }, "require": { @@ -3595,9 +3595,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.71.12" + "source": "https://github.com/utopia-php/database/tree/0.71.13" }, - "time": "2025-08-05T09:38:25+00:00" + "time": "2025-08-11T10:47:16+00:00" }, { "name": "utopia-php/detector",