diff --git a/app/init/resources.php b/app/init/resources.php index 946a977aa4..06a916a58d 100644 --- a/app/init/resources.php +++ b/app/init/resources.php @@ -234,16 +234,18 @@ App::setResource('user', function ($mode, $project, $console, $request, $respons Auth::$unique = $session['id'] ?? ''; Auth::$secret = $session['secret'] ?? ''; - if ($mode === APP_MODE_ADMIN) { - $user = $dbForPlatform->getDocument('users', Auth::$unique); - } else { - if ($project->isEmpty()) { - $user = new Document([]); + $user = new Document([]); + + if (!empty(Auth::$unique)){ + if ($mode === APP_MODE_ADMIN) { + $user = $dbForPlatform->getDocument('users', Auth::$unique); } else { - if ($project->getId() === 'console') { - $user = $dbForPlatform->getDocument('users', Auth::$unique); - } else { - $user = $dbForProject->getDocument('users', Auth::$unique); + if (!$project->isEmpty()) { + if ($project->getId() === 'console') { + $user = $dbForPlatform->getDocument('users', Auth::$unique); + } else { + $user = $dbForProject->getDocument('users', Auth::$unique); + } } } } @@ -849,11 +851,20 @@ App::setResource('team', function (Document $project, Database $dbForPlatform, A $teamInternalId = $p->getAttribute('teamInternalId', ''); } elseif ($path === '/v1/projects') { $teamId = $request->getParam('teamId', ''); + + if (empty($teamId)){ + return new Document([]); + } + $team = Authorization::skip(fn () => $dbForPlatform->getDocument('teams', $teamId)); return $team; } } + if (empty($teamInternalId)){ + return new Document([]); + } + $team = Authorization::skip(function () use ($dbForPlatform, $teamInternalId) { return $dbForPlatform->findOne('teams', [ Query::equal('$sequence', [$teamInternalId]), diff --git a/composer.json b/composer.json index 40740b711f..d76918fa7e 100644 --- a/composer.json +++ b/composer.json @@ -52,7 +52,7 @@ "utopia-php/cache": "0.13.*", "utopia-php/cli": "0.15.*", "utopia-php/config": "0.2.*", - "utopia-php/database": "0.73.*", + "utopia-php/database": "dev-cast-sequence as 0.73.2", "utopia-php/detector": "0.1.*", "utopia-php/domains": "0.8.*", "utopia-php/dsn": "0.2.1", diff --git a/composer.lock b/composer.lock index bddc8ec936..db551ed0f4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f152305ec0b90245773867cde288582d", + "content-hash": "69f5a2e965cd9c1233044629699d3d28", "packages": [ { "name": "adhocore/jwt", @@ -3493,16 +3493,16 @@ }, { "name": "utopia-php/database", - "version": "0.73.2", + "version": "dev-cast-sequence", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "68545dfd5d1ac41ca2f4f5a59719b890fcd8f480" + "reference": "749cb0606a88ad4282b182feaa7e380627126b86" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/68545dfd5d1ac41ca2f4f5a59719b890fcd8f480", - "reference": "68545dfd5d1ac41ca2f4f5a59719b890fcd8f480", + "url": "https://api.github.com/repos/utopia-php/database/zipball/749cb0606a88ad4282b182feaa7e380627126b86", + "reference": "749cb0606a88ad4282b182feaa7e380627126b86", "shasum": "" }, "require": { @@ -3543,9 +3543,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.73.2" + "source": "https://github.com/utopia-php/database/tree/cast-sequence" }, - "time": "2025-07-29T03:23:04+00:00" + "time": "2025-07-29T05:33:45+00:00" }, { "name": "utopia-php/detector", @@ -8237,9 +8237,18 @@ "time": "2024-03-07T20:33:40+00:00" } ], - "aliases": [], + "aliases": [ + { + "package": "utopia-php/database", + "version": "dev-cast-sequence", + "alias": "0.73.2", + "alias_normalized": "0.73.2.0" + } + ], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "utopia-php/database": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": {