From b3db296f13c00fa539287550580abcb6cd3d9e26 Mon Sep 17 00:00:00 2001 From: shimon Date: Sun, 16 Mar 2025 14:05:03 +0200 Subject: [PATCH] sync with main --- app/init/resources.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/init/resources.php b/app/init/resources.php index 96c52a2350..22ec4c3c96 100644 --- a/app/init/resources.php +++ b/app/init/resources.php @@ -285,6 +285,16 @@ App::setResource('project', function ($dbForPlatform, $request, $console) { $project = Authorization::skip(fn () => $dbForPlatform->getDocument('projects', $projectId)); + if (!empty($project->getAttribute('region')) && $project->getAttribute('region') !== System::getEnv('_APP_REGION', 'default')) { + var_dump([ + 'projectId' => $project->getId(), + 'projectRegion' => $project->getAttribute('region'), + '_APP_REGION' => System::getEnv('_APP_REGION'), + ]); + + throw new Exception(Exception::GENERAL_ACCESS_FORBIDDEN, 'Project is not accessible in this region. Please make sure you are using the correct endpoint'); + } + return $project; }, ['dbForPlatform', 'request', 'console']);