From 81c33855fe60223d450261102889c2cec080dd6d Mon Sep 17 00:00:00 2001 From: Harsh Mahajan <127186841+HarshMN2345@users.noreply.github.com> Date: Mon, 8 Jun 2026 11:34:55 +0530 Subject: [PATCH 1/4] =?UTF-8?q?Revert=20"Revert=20"feat:=20embed=20imperso?= =?UTF-8?q?nateUserId=20in=20location-type=20SDK=20method=20URL=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit ac00aa34f171efad142f8919def0a55827b5085b. --- app/init/realtime/connection.php | 6 +- app/init/resources/request.php | 6 +- .../Modules/Avatars/Http/Browsers/Get.php | 1 + .../Modules/Avatars/Http/CreditCards/Get.php | 1 + .../Modules/Avatars/Http/Favicon/Get.php | 1 + .../Modules/Avatars/Http/Flags/Get.php | 1 + .../Modules/Avatars/Http/Image/Get.php | 1 + .../Modules/Avatars/Http/Initials/Get.php | 1 + .../Platform/Modules/Avatars/Http/QR/Get.php | 1 + .../Modules/Avatars/Http/Screenshots/Get.php | 1 + .../Http/Deployments/Download/Get.php | 3 +- .../Sites/Http/Deployments/Download/Get.php | 1 + .../Http/Buckets/Files/Download/Get.php | 3 +- .../Http/Buckets/Files/Preview/Get.php | 1 + .../Storage/Http/Buckets/Files/View/Get.php | 3 +- src/Appwrite/Platform/Tasks/Specs.php | 54 ++++++++++++ src/Appwrite/SDK/Method.php | 12 +-- .../SDK/Specification/Format/OpenAPI3.php | 14 +++- .../SDK/Specification/Format/Swagger2.php | 14 +++- .../Storage/StorageConsoleClientTest.php | 80 ++++++++++++++++++ .../Services/Users/UsersConsoleClientTest.php | 83 +++++++++++++++++++ 21 files changed, 267 insertions(+), 21 deletions(-) diff --git a/app/init/realtime/connection.php b/app/init/realtime/connection.php index a090635bb5..ea00b7f356 100644 --- a/app/init/realtime/connection.php +++ b/app/init/realtime/connection.php @@ -329,9 +329,9 @@ return function (Container $container): void { // Query params mirror the header fallback pattern used by ?project= and ?devKey=, // allowing Console to embed impersonation in direct file/image URLs where headers cannot be set. - $impersonateUserId = $request->getHeader('x-appwrite-impersonate-user-id', (string)$request->getParam('impersonateUserId', '')); - $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)$request->getParam('impersonateEmail', '')); - $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)$request->getParam('impersonatePhone', '')); + $impersonateUserId = $request->getHeader('x-appwrite-impersonate-user-id', (string)($request->getParam('impersonateuserid', '') ?: $request->getParam('impersonateUserId', ''))); + $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)($request->getParam('impersonateemail', '') ?: $request->getParam('impersonateEmail', ''))); + $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)($request->getParam('impersonatephone', '') ?: $request->getParam('impersonatePhone', ''))); if (!$user->isEmpty() && $user->getAttribute('impersonator', false)) { $userDb = ($mode === APP_MODE_ADMIN || $project->getId() === 'console') ? $dbForPlatform : $dbForProject; diff --git a/app/init/resources/request.php b/app/init/resources/request.php index 416c294140..f7a98e0f8f 100644 --- a/app/init/resources/request.php +++ b/app/init/resources/request.php @@ -491,9 +491,9 @@ return function (Container $context): void { // Impersonation: if current user has impersonator capability and headers/params are set, act as another user // Query params mirror the header fallback pattern used by ?project= and ?devKey=, // allowing Console to embed impersonation in direct file/image URLs where headers cannot be set. - $impersonateUserId = $request->getHeader('x-appwrite-impersonate-user-id', (string)$request->getParam('impersonateUserId', '')); - $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)$request->getParam('impersonateEmail', '')); - $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)$request->getParam('impersonatePhone', '')); + $impersonateUserId = $request->getHeader('x-appwrite-impersonate-user-id', (string)($request->getParam('impersonateuserid', '') ?: $request->getParam('impersonateUserId', ''))); + $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)($request->getParam('impersonateemail', '') ?: $request->getParam('impersonateEmail', ''))); + $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)($request->getParam('impersonatephone', '') ?: $request->getParam('impersonatePhone', ''))); if (!$user->isEmpty() && $user->getAttribute('impersonator', false)) { $userDb = (APP_MODE_ADMIN === $mode || $project->getId() === 'console') ? $dbForPlatform : $dbForProject; $targetUser = null; diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php index cc30f014bc..2d66b5b21b 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php @@ -42,6 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-browser.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php index 3bae32c862..710c7cd61d 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php @@ -42,6 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-credit-card.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php index 6faa0fe223..244f426c4d 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php @@ -54,6 +54,7 @@ class Get extends Action description: '/docs/references/avatars/get-favicon.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php index ef9f8c0e47..dfeaff0f8a 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php @@ -42,6 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-flag.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php index 315202d4d5..3c791aa128 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php @@ -45,6 +45,7 @@ class Get extends Action description: '/docs/references/avatars/get-image.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php index c73d20fb0c..792026577b 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php @@ -44,6 +44,7 @@ class Get extends Action description: '/docs/references/avatars/get-initials.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php index f3448f5264..b8f3d0247d 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php @@ -42,6 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-qr.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php index 51d4df2a49..63d7d3f85e 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php @@ -57,6 +57,7 @@ class Get extends Action description: '/docs/references/avatars/get-screenshot.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php index c92e3c1406..8adff12784 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php @@ -52,7 +52,8 @@ class Get extends Action ) ], contentType: ContentType::ANY, - type: MethodType::LOCATION + type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], )) ->param('functionId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Function ID.', false, ['dbForProject']) ->param('deploymentId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Deployment ID.', false, ['dbForProject']) diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php index 0ab998292d..088bf6c499 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php @@ -51,6 +51,7 @@ class Get extends Action ) ], type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], contentType: ContentType::ANY, )) ->param('siteId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Site ID.', false, ['dbForProject']) diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php index 7e5d7d6879..a11560cd5a 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php @@ -57,7 +57,8 @@ class Get extends Action ) ], contentType: ContentType::ANY, - type: MethodType::LOCATION + type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], )) ->param('bucketId', '', new UID(), 'Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') ->param('fileId', '', new UID(), 'File ID.') diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php index 9c316a3b57..dcc033260f 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php @@ -71,6 +71,7 @@ class Get extends Action ) ], type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], contentType: ContentType::IMAGE )) ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php index b78d582c47..a88b41b3bc 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php @@ -58,7 +58,8 @@ class Get extends Action ) ], contentType: ContentType::ANY, - type: MethodType::LOCATION + type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], )) ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') ->param('fileId', '', new UID(), 'File ID.') diff --git a/src/Appwrite/Platform/Tasks/Specs.php b/src/Appwrite/Platform/Tasks/Specs.php index 8717ae742e..fa3889125d 100644 --- a/src/Appwrite/Platform/Tasks/Specs.php +++ b/src/Appwrite/Platform/Tasks/Specs.php @@ -181,18 +181,36 @@ class Specs extends Action 'description' => 'Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], + 'ImpersonateUserQuery' => [ + 'type' => 'apiKey', + 'name' => 'impersonateUserId', + 'description' => 'Impersonate a user by ID via query param. Used for location-type methods where headers cannot be set.', + 'in' => 'query', + ], 'ImpersonateUserEmail' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Email', 'description' => 'Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], + 'ImpersonateUserEmailQuery' => [ + 'type' => 'apiKey', + 'name' => 'impersonateEmail', + 'description' => 'Impersonate a user by email via query param. Used for location-type methods where headers cannot be set.', + 'in' => 'query', + ], 'ImpersonateUserPhone' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Phone', 'description' => 'Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], + 'ImpersonateUserPhoneQuery' => [ + 'type' => 'apiKey', + 'name' => 'impersonatePhone', + 'description' => 'Impersonate a user by phone via query param. Used for location-type methods where headers cannot be set.', + 'in' => 'query', + ], ], APP_SDK_PLATFORM_SERVER => [ 'Project' => [ @@ -255,18 +273,36 @@ class Specs extends Action 'description' => 'Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], + 'ImpersonateUserQuery' => [ + 'type' => 'apiKey', + 'name' => 'impersonateUserId', + 'description' => 'Impersonate a user by ID via query param. Used for location-type methods where headers cannot be set.', + 'in' => 'query', + ], 'ImpersonateUserEmail' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Email', 'description' => 'Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], + 'ImpersonateUserEmailQuery' => [ + 'type' => 'apiKey', + 'name' => 'impersonateEmail', + 'description' => 'Impersonate a user by email via query param. Used for location-type methods where headers cannot be set.', + 'in' => 'query', + ], 'ImpersonateUserPhone' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Phone', 'description' => 'Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], + 'ImpersonateUserPhoneQuery' => [ + 'type' => 'apiKey', + 'name' => 'impersonatePhone', + 'description' => 'Impersonate a user by phone via query param. Used for location-type methods where headers cannot be set.', + 'in' => 'query', + ], ], APP_SDK_PLATFORM_CONSOLE => [ 'Project' => [ @@ -329,18 +365,36 @@ class Specs extends Action 'description' => 'Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], + 'ImpersonateUserQuery' => [ + 'type' => 'apiKey', + 'name' => 'impersonateUserId', + 'description' => 'Impersonate a user by ID via query param. Used for location-type methods where headers cannot be set.', + 'in' => 'query', + ], 'ImpersonateUserEmail' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Email', 'description' => 'Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], + 'ImpersonateUserEmailQuery' => [ + 'type' => 'apiKey', + 'name' => 'impersonateEmail', + 'description' => 'Impersonate a user by email via query param. Used for location-type methods where headers cannot be set.', + 'in' => 'query', + ], 'ImpersonateUserPhone' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Phone', 'description' => 'Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], + 'ImpersonateUserPhoneQuery' => [ + 'type' => 'apiKey', + 'name' => 'impersonatePhone', + 'description' => 'Impersonate a user by phone via query param. Used for location-type methods where headers cannot be set.', + 'in' => 'query', + ], ], ]; } diff --git a/src/Appwrite/SDK/Method.php b/src/Appwrite/SDK/Method.php index 5f6ccf9a0f..f1b327513f 100644 --- a/src/Appwrite/SDK/Method.php +++ b/src/Appwrite/SDK/Method.php @@ -32,7 +32,7 @@ class Method * @param array $additionalParameters * @param string $desc * @param bool $public Whether this method should be rendered on the website/documentation - * @param string $projectAuth Project authentication security scheme to use in specs + * @param array $locationAuth Security scheme keys injected for location-type methods (includes project auth) */ public function __construct( protected string $namespace, @@ -51,16 +51,12 @@ class Method protected array $additionalParameters = [], protected string $desc = '', protected bool $public = true, - protected string $projectAuth = 'Project' + protected array $locationAuth = [] ) { $this->validateMethod($name, $namespace); $this->validateAuthTypes($auth); $this->validateDesc($description); - if (!\in_array($projectAuth, ['Project', 'ProjectQuery'], true)) { - self::$errors[] = "Error with {$this->getRouteName()} method: Invalid project auth scheme"; - } - foreach ($responses as $response) { $this->validateResponseModel($response->getModel()); $this->validateNoContent($response); @@ -229,9 +225,9 @@ class Method return $this->additionalParameters; } - public function getProjectAuth(): string + public function getLocationAuth(): array { - return $this->projectAuth; + return $this->locationAuth; } public function setNamespace(string $namespace): self diff --git a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php index dfa38b0bf5..d9c2bf301e 100644 --- a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php @@ -188,7 +188,7 @@ class OpenAPI3 extends Format continue; } - $methodSecurities = [$methodObj->getProjectAuth() => []]; + $methodSecurities = [($methodObj->getLocationAuth()[0] ?? 'Project') => []]; foreach ($methodObj->getAuth() as $security) { if (\array_key_exists($security->value, $this->keys)) { $methodSecurities[$security->value] = []; @@ -374,7 +374,7 @@ class OpenAPI3 extends Format } if (!empty($scope)) { - $securities = [$sdk->getProjectAuth() => []]; + $securities = [($sdk->getLocationAuth()[0] ?? 'Project') => []]; foreach ($sdk->getAuth() as $security) { /** @var AuthType $security */ @@ -384,6 +384,16 @@ class OpenAPI3 extends Format } $temp['x-appwrite']['auth'] = array_slice($securities, 0, $this->authCount); + + if ($sdk->getType() === MethodType::LOCATION) { + foreach ($sdk->getLocationAuth() as $key) { + if (\array_key_exists($key, $this->keys)) { + $securities[$key] = []; + $temp['x-appwrite']['auth'][$key] = []; + } + } + } + $temp['security'][] = $securities; } diff --git a/src/Appwrite/SDK/Specification/Format/Swagger2.php b/src/Appwrite/SDK/Specification/Format/Swagger2.php index 20b1fb9b94..b1541d5ddb 100644 --- a/src/Appwrite/SDK/Specification/Format/Swagger2.php +++ b/src/Appwrite/SDK/Specification/Format/Swagger2.php @@ -188,7 +188,7 @@ class Swagger2 extends Format continue; } - $methodSecurities = [$methodObj->getProjectAuth() => []]; + $methodSecurities = [($methodObj->getLocationAuth()[0] ?? 'Project') => []]; foreach ($methodObj->getAuth() as $security) { /** @var AuthType $security */ if (\array_key_exists($security->value, $this->keys)) { @@ -365,7 +365,7 @@ class Swagger2 extends Format } if (!empty($scope)) { - $securities = [$sdk->getProjectAuth() => []]; + $securities = [($sdk->getLocationAuth()[0] ?? 'Project') => []]; foreach ($sdk->getAuth() as $security) { if (\array_key_exists($security->value, $this->keys)) { @@ -374,6 +374,16 @@ class Swagger2 extends Format } $temp['x-appwrite']['auth'] = \array_slice($securities, 0, $this->authCount); + + if ($sdk->getType() === MethodType::LOCATION) { + foreach ($sdk->getLocationAuth() as $key) { + if (\array_key_exists($key, $this->keys)) { + $securities[$key] = []; + $temp['x-appwrite']['auth'][$key] = []; + } + } + } + $temp['security'][] = $securities; } diff --git a/tests/e2e/Services/Storage/StorageConsoleClientTest.php b/tests/e2e/Services/Storage/StorageConsoleClientTest.php index 9d2a639631..aca2717170 100644 --- a/tests/e2e/Services/Storage/StorageConsoleClientTest.php +++ b/tests/e2e/Services/Storage/StorageConsoleClientTest.php @@ -10,6 +10,8 @@ use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideConsole; use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; final class StorageConsoleClientTest extends Scope { @@ -198,4 +200,82 @@ final class StorageConsoleClientTest extends Scope ], $this->getHeaders())); $this->assertEquals(204, $response['headers']['status-code']); } + + public function testFilePreviewWithImpersonation(): void + { + $projectId = $this->getProject()['$id']; + $adminHeaders = array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()); + + $targetId = ID::unique(); + $target = $this->client->call(Client::METHOD_POST, '/users', $adminHeaders, [ + 'userId' => $targetId, + 'email' => 'impersonation-storage-target-' . $targetId . '@example.com', + 'password' => 'password123', + 'name' => 'Storage Target', + ]); + $this->assertEquals(201, $target['headers']['status-code']); + + $actorId = ID::unique(); + $this->client->call(Client::METHOD_POST, '/users', $adminHeaders, [ + 'userId' => $actorId, + 'email' => 'impersonation-storage-actor-' . $actorId . '@example.com', + 'password' => 'password123', + 'name' => 'Storage Actor', + ]); + $this->client->call(Client::METHOD_PATCH, '/users/' . $actorId . '/impersonator', $adminHeaders, [ + 'impersonator' => true, + ]); + + $bucket = $this->client->call(Client::METHOD_POST, '/storage/buckets', $adminHeaders, [ + 'bucketId' => ID::unique(), + 'name' => 'Impersonation Test Bucket', + 'fileSecurity' => true, + 'permissions' => [ + Permission::read(Role::user($targetId)), + Permission::create(Role::any()), + ], + ]); + $this->assertEquals(201, $bucket['headers']['status-code']); + $bucketId = $bucket['body']['$id']; + + $file = $this->client->call(Client::METHOD_POST, '/storage/buckets/' . $bucketId . '/files', array_merge( + $adminHeaders, + ['content-type' => 'multipart/form-data'] + ), [ + 'fileId' => ID::unique(), + 'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/logo.png'), 'image/png', 'logo.png'), + 'permissions' => [ + Permission::read(Role::user($targetId)), + ], + ]); + $this->assertEquals(201, $file['headers']['status-code']); + $fileId = $file['body']['$id']; + + $session = $this->client->call(Client::METHOD_POST, '/users/' . $actorId . '/sessions', $adminHeaders); + $this->assertEquals(201, $session['headers']['status-code']); + + $sessionHeaders = [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-session' => $session['body']['secret'], + ]; + + $denied = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucketId . '/files/' . $fileId . '/preview', $sessionHeaders); + $this->assertEquals(404, $denied['headers']['status-code']); + + $preview = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucketId . '/files/' . $fileId . '/preview', $sessionHeaders, [ + 'impersonateuserid' => $targetId, + ]); + $this->assertEquals(200, $preview['headers']['status-code']); + $this->assertEquals('image/png', $preview['headers']['content-type']); + $this->assertNotEmpty($preview['body']); + + $view = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucketId . '/files/' . $fileId . '/view', $sessionHeaders, [ + 'impersonateuserid' => $targetId, + ]); + $this->assertEquals(200, $view['headers']['status-code']); + } } diff --git a/tests/e2e/Services/Users/UsersConsoleClientTest.php b/tests/e2e/Services/Users/UsersConsoleClientTest.php index 1ac901bf58..373b941fb4 100644 --- a/tests/e2e/Services/Users/UsersConsoleClientTest.php +++ b/tests/e2e/Services/Users/UsersConsoleClientTest.php @@ -83,4 +83,87 @@ final class UsersConsoleClientTest extends Scope $this->assertEquals($userId, $set['body']['$id']); $this->assertNotEmpty($set['body']['password']); } + + public function testImpersonateQueryParams(): void + { + $projectId = $this->getProject()['$id']; + $headers = array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()); + + $actorId = ID::unique(); + $actor = $this->client->call(Client::METHOD_POST, '/users', $headers, [ + 'userId' => $actorId, + 'email' => 'impersonator-queryparam-' . $actorId . '@example.com', + 'password' => 'password123', + 'name' => 'Impersonator', + ]); + $this->assertEquals(201, $actor['headers']['status-code']); + + $targetId = ID::unique(); + $targetEmail = 'target-queryparam-' . $targetId . '@example.com'; + $targetPhone = '+1' . rand(2000000000, 2999999999); + + $target = $this->client->call(Client::METHOD_POST, '/users', $headers, [ + 'userId' => $targetId, + 'email' => $targetEmail, + 'password' => 'password123', + 'name' => 'Target', + ]); + $this->assertEquals(201, $target['headers']['status-code']); + + $this->client->call(Client::METHOD_PATCH, '/users/' . $targetId . '/phone', $headers, [ + 'number' => $targetPhone, + ]); + + $this->client->call(Client::METHOD_PATCH, '/users/' . $actorId . '/impersonator', $headers, [ + 'impersonator' => true, + ]); + + $session = $this->client->call(Client::METHOD_POST, '/users/' . $actorId . '/sessions', $headers); + $this->assertEquals(201, $session['headers']['status-code']); + + $sessionHeaders = [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-session' => $session['body']['secret'], + ]; + + $byHeader = $this->client->call(Client::METHOD_GET, '/account', array_merge($sessionHeaders, [ + 'x-appwrite-impersonate-user-id' => $targetId, + ])); + $this->assertEquals(200, $byHeader['headers']['status-code']); + $this->assertEquals($targetId, $byHeader['body']['$id']); + $this->assertEquals($actorId, $byHeader['body']['impersonatorUserId']); + + $byUserId = $this->client->call(Client::METHOD_GET, '/account', $sessionHeaders, [ + 'impersonateuserid' => $targetId, + ]); + $this->assertEquals(200, $byUserId['headers']['status-code']); + $this->assertEquals($targetId, $byUserId['body']['$id']); + + $byEmail = $this->client->call(Client::METHOD_GET, '/account', $sessionHeaders, [ + 'impersonateemail' => $targetEmail, + ]); + $this->assertEquals(200, $byEmail['headers']['status-code']); + $this->assertEquals($targetId, $byEmail['body']['$id']); + + $byPhone = $this->client->call(Client::METHOD_GET, '/account', $sessionHeaders, [ + 'impersonatephone' => $targetPhone, + ]); + $this->assertEquals(200, $byPhone['headers']['status-code']); + $this->assertEquals($targetId, $byPhone['body']['$id']); + + // header takes priority over query param + $priority = $this->client->call( + Client::METHOD_GET, + '/account', + array_merge($sessionHeaders, ['x-appwrite-impersonate-user-id' => $targetId]), + ['impersonateuserid' => $actorId] + ); + $this->assertEquals(200, $priority['headers']['status-code']); + $this->assertEquals($targetId, $priority['body']['$id']); + } } From 29272b7186cda0d66888206c049655d2ad75c0bb Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Mon, 8 Jun 2026 11:38:23 +0530 Subject: [PATCH 2/4] fix: use header scheme keys in locationAuth, add impersonateUserEmail/Phone param aliases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use ImpersonateUserId/Email/Phone directly in locationAuth — their caseLower maps to existing config keys set by the corresponding setters. Add impersonateUserEmail and impersonateUserPhone as backend param fallbacks to match caseCamel output of those keys in LOCATION method URLs. --- app/init/realtime/connection.php | 4 +- app/init/resources/request.php | 4 +- .../Modules/Avatars/Http/Browsers/Get.php | 2 +- .../Modules/Avatars/Http/CreditCards/Get.php | 2 +- .../Modules/Avatars/Http/Favicon/Get.php | 2 +- .../Modules/Avatars/Http/Flags/Get.php | 2 +- .../Modules/Avatars/Http/Image/Get.php | 2 +- .../Modules/Avatars/Http/Initials/Get.php | 2 +- .../Platform/Modules/Avatars/Http/QR/Get.php | 2 +- .../Modules/Avatars/Http/Screenshots/Get.php | 2 +- .../Http/Deployments/Download/Get.php | 2 +- .../Sites/Http/Deployments/Download/Get.php | 2 +- .../Http/Buckets/Files/Download/Get.php | 2 +- .../Http/Buckets/Files/Preview/Get.php | 2 +- .../Storage/Http/Buckets/Files/View/Get.php | 2 +- src/Appwrite/Platform/Tasks/Specs.php | 54 ------------------- 16 files changed, 17 insertions(+), 71 deletions(-) diff --git a/app/init/realtime/connection.php b/app/init/realtime/connection.php index ea00b7f356..63ecf2ca52 100644 --- a/app/init/realtime/connection.php +++ b/app/init/realtime/connection.php @@ -330,8 +330,8 @@ return function (Container $container): void { // Query params mirror the header fallback pattern used by ?project= and ?devKey=, // allowing Console to embed impersonation in direct file/image URLs where headers cannot be set. $impersonateUserId = $request->getHeader('x-appwrite-impersonate-user-id', (string)($request->getParam('impersonateuserid', '') ?: $request->getParam('impersonateUserId', ''))); - $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)($request->getParam('impersonateemail', '') ?: $request->getParam('impersonateEmail', ''))); - $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)($request->getParam('impersonatephone', '') ?: $request->getParam('impersonatePhone', ''))); + $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)($request->getParam('impersonateemail', '') ?: $request->getParam('impersonateEmail', '') ?: $request->getParam('impersonateUserEmail', ''))); + $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)($request->getParam('impersonatephone', '') ?: $request->getParam('impersonatePhone', '') ?: $request->getParam('impersonateUserPhone', ''))); if (!$user->isEmpty() && $user->getAttribute('impersonator', false)) { $userDb = ($mode === APP_MODE_ADMIN || $project->getId() === 'console') ? $dbForPlatform : $dbForProject; diff --git a/app/init/resources/request.php b/app/init/resources/request.php index f7a98e0f8f..b505077c9b 100644 --- a/app/init/resources/request.php +++ b/app/init/resources/request.php @@ -492,8 +492,8 @@ return function (Container $context): void { // Query params mirror the header fallback pattern used by ?project= and ?devKey=, // allowing Console to embed impersonation in direct file/image URLs where headers cannot be set. $impersonateUserId = $request->getHeader('x-appwrite-impersonate-user-id', (string)($request->getParam('impersonateuserid', '') ?: $request->getParam('impersonateUserId', ''))); - $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)($request->getParam('impersonateemail', '') ?: $request->getParam('impersonateEmail', ''))); - $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)($request->getParam('impersonatephone', '') ?: $request->getParam('impersonatePhone', ''))); + $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)($request->getParam('impersonateemail', '') ?: $request->getParam('impersonateEmail', '') ?: $request->getParam('impersonateUserEmail', ''))); + $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)($request->getParam('impersonatephone', '') ?: $request->getParam('impersonatePhone', '') ?: $request->getParam('impersonateUserPhone', ''))); if (!$user->isEmpty() && $user->getAttribute('impersonator', false)) { $userDb = (APP_MODE_ADMIN === $mode || $project->getId() === 'console') ? $dbForPlatform : $dbForProject; $targetUser = null; diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php index 2d66b5b21b..d5ff7257fe 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php @@ -42,7 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-browser.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php index 710c7cd61d..15e558e345 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php @@ -42,7 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-credit-card.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php index 244f426c4d..a284ff8ef3 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php @@ -54,7 +54,7 @@ class Get extends Action description: '/docs/references/avatars/get-favicon.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php index dfeaff0f8a..e0834726da 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php @@ -42,7 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-flag.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php index 3c791aa128..f8a2c90b89 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php @@ -45,7 +45,7 @@ class Get extends Action description: '/docs/references/avatars/get-image.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php index 792026577b..a10bed6bd8 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php @@ -44,7 +44,7 @@ class Get extends Action description: '/docs/references/avatars/get-initials.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php index b8f3d0247d..c135678489 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php @@ -42,7 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-qr.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php index 63d7d3f85e..13b120d9f9 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php @@ -57,7 +57,7 @@ class Get extends Action description: '/docs/references/avatars/get-screenshot.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php index 8adff12784..d0e3195e9d 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php @@ -53,7 +53,7 @@ class Get extends Action ], contentType: ContentType::ANY, type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], )) ->param('functionId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Function ID.', false, ['dbForProject']) ->param('deploymentId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Deployment ID.', false, ['dbForProject']) diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php index 088bf6c499..c13c67427f 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php @@ -51,7 +51,7 @@ class Get extends Action ) ], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], contentType: ContentType::ANY, )) ->param('siteId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Site ID.', false, ['dbForProject']) diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php index a11560cd5a..35e3b580fd 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php @@ -58,7 +58,7 @@ class Get extends Action ], contentType: ContentType::ANY, type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], )) ->param('bucketId', '', new UID(), 'Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') ->param('fileId', '', new UID(), 'File ID.') diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php index dcc033260f..0474630b40 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php @@ -71,7 +71,7 @@ class Get extends Action ) ], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], contentType: ContentType::IMAGE )) ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php index a88b41b3bc..c12b6d1aff 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php @@ -59,7 +59,7 @@ class Get extends Action ], contentType: ContentType::ANY, type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], )) ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') ->param('fileId', '', new UID(), 'File ID.') diff --git a/src/Appwrite/Platform/Tasks/Specs.php b/src/Appwrite/Platform/Tasks/Specs.php index fa3889125d..8717ae742e 100644 --- a/src/Appwrite/Platform/Tasks/Specs.php +++ b/src/Appwrite/Platform/Tasks/Specs.php @@ -181,36 +181,18 @@ class Specs extends Action 'description' => 'Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], - 'ImpersonateUserQuery' => [ - 'type' => 'apiKey', - 'name' => 'impersonateUserId', - 'description' => 'Impersonate a user by ID via query param. Used for location-type methods where headers cannot be set.', - 'in' => 'query', - ], 'ImpersonateUserEmail' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Email', 'description' => 'Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], - 'ImpersonateUserEmailQuery' => [ - 'type' => 'apiKey', - 'name' => 'impersonateEmail', - 'description' => 'Impersonate a user by email via query param. Used for location-type methods where headers cannot be set.', - 'in' => 'query', - ], 'ImpersonateUserPhone' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Phone', 'description' => 'Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], - 'ImpersonateUserPhoneQuery' => [ - 'type' => 'apiKey', - 'name' => 'impersonatePhone', - 'description' => 'Impersonate a user by phone via query param. Used for location-type methods where headers cannot be set.', - 'in' => 'query', - ], ], APP_SDK_PLATFORM_SERVER => [ 'Project' => [ @@ -273,36 +255,18 @@ class Specs extends Action 'description' => 'Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], - 'ImpersonateUserQuery' => [ - 'type' => 'apiKey', - 'name' => 'impersonateUserId', - 'description' => 'Impersonate a user by ID via query param. Used for location-type methods where headers cannot be set.', - 'in' => 'query', - ], 'ImpersonateUserEmail' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Email', 'description' => 'Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], - 'ImpersonateUserEmailQuery' => [ - 'type' => 'apiKey', - 'name' => 'impersonateEmail', - 'description' => 'Impersonate a user by email via query param. Used for location-type methods where headers cannot be set.', - 'in' => 'query', - ], 'ImpersonateUserPhone' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Phone', 'description' => 'Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], - 'ImpersonateUserPhoneQuery' => [ - 'type' => 'apiKey', - 'name' => 'impersonatePhone', - 'description' => 'Impersonate a user by phone via query param. Used for location-type methods where headers cannot be set.', - 'in' => 'query', - ], ], APP_SDK_PLATFORM_CONSOLE => [ 'Project' => [ @@ -365,36 +329,18 @@ class Specs extends Action 'description' => 'Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], - 'ImpersonateUserQuery' => [ - 'type' => 'apiKey', - 'name' => 'impersonateUserId', - 'description' => 'Impersonate a user by ID via query param. Used for location-type methods where headers cannot be set.', - 'in' => 'query', - ], 'ImpersonateUserEmail' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Email', 'description' => 'Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], - 'ImpersonateUserEmailQuery' => [ - 'type' => 'apiKey', - 'name' => 'impersonateEmail', - 'description' => 'Impersonate a user by email via query param. Used for location-type methods where headers cannot be set.', - 'in' => 'query', - ], 'ImpersonateUserPhone' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Impersonate-User-Phone', 'description' => 'Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.', 'in' => 'header', ], - 'ImpersonateUserPhoneQuery' => [ - 'type' => 'apiKey', - 'name' => 'impersonatePhone', - 'description' => 'Impersonate a user by phone via query param. Used for location-type methods where headers cannot be set.', - 'in' => 'query', - ], ], ]; } From ebbb7737190f4da057ecc1de631e54e707528241 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Mon, 8 Jun 2026 11:44:33 +0530 Subject: [PATCH 3/4] fix: remove unnecessary impersonateUserEmail/Phone param aliases --- app/init/realtime/connection.php | 4 ++-- app/init/resources/request.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/init/realtime/connection.php b/app/init/realtime/connection.php index 63ecf2ca52..ea00b7f356 100644 --- a/app/init/realtime/connection.php +++ b/app/init/realtime/connection.php @@ -330,8 +330,8 @@ return function (Container $container): void { // Query params mirror the header fallback pattern used by ?project= and ?devKey=, // allowing Console to embed impersonation in direct file/image URLs where headers cannot be set. $impersonateUserId = $request->getHeader('x-appwrite-impersonate-user-id', (string)($request->getParam('impersonateuserid', '') ?: $request->getParam('impersonateUserId', ''))); - $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)($request->getParam('impersonateemail', '') ?: $request->getParam('impersonateEmail', '') ?: $request->getParam('impersonateUserEmail', ''))); - $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)($request->getParam('impersonatephone', '') ?: $request->getParam('impersonatePhone', '') ?: $request->getParam('impersonateUserPhone', ''))); + $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)($request->getParam('impersonateemail', '') ?: $request->getParam('impersonateEmail', ''))); + $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)($request->getParam('impersonatephone', '') ?: $request->getParam('impersonatePhone', ''))); if (!$user->isEmpty() && $user->getAttribute('impersonator', false)) { $userDb = ($mode === APP_MODE_ADMIN || $project->getId() === 'console') ? $dbForPlatform : $dbForProject; diff --git a/app/init/resources/request.php b/app/init/resources/request.php index b505077c9b..f7a98e0f8f 100644 --- a/app/init/resources/request.php +++ b/app/init/resources/request.php @@ -492,8 +492,8 @@ return function (Container $context): void { // Query params mirror the header fallback pattern used by ?project= and ?devKey=, // allowing Console to embed impersonation in direct file/image URLs where headers cannot be set. $impersonateUserId = $request->getHeader('x-appwrite-impersonate-user-id', (string)($request->getParam('impersonateuserid', '') ?: $request->getParam('impersonateUserId', ''))); - $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)($request->getParam('impersonateemail', '') ?: $request->getParam('impersonateEmail', '') ?: $request->getParam('impersonateUserEmail', ''))); - $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)($request->getParam('impersonatephone', '') ?: $request->getParam('impersonatePhone', '') ?: $request->getParam('impersonateUserPhone', ''))); + $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)($request->getParam('impersonateemail', '') ?: $request->getParam('impersonateEmail', ''))); + $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)($request->getParam('impersonatephone', '') ?: $request->getParam('impersonatePhone', ''))); if (!$user->isEmpty() && $user->getAttribute('impersonator', false)) { $userDb = (APP_MODE_ADMIN === $mode || $project->getId() === 'console') ? $dbForPlatform : $dbForProject; $targetUser = null; From 4301bd8e89d15a2fbe2f941c18290de6dfc81f00 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Mon, 8 Jun 2026 13:28:41 +0530 Subject: [PATCH 4/4] fix: remove ImpersonateUserEmail/Phone from locationAuth to avoid empty params in URLs --- src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php | 2 +- src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php | 2 +- src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php | 2 +- src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php | 2 +- src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php | 2 +- src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php | 2 +- src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php | 2 +- src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php | 2 +- .../Modules/Functions/Http/Deployments/Download/Get.php | 2 +- .../Platform/Modules/Sites/Http/Deployments/Download/Get.php | 2 +- .../Modules/Storage/Http/Buckets/Files/Download/Get.php | 2 +- .../Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php | 2 +- .../Platform/Modules/Storage/Http/Buckets/Files/View/Get.php | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php index d5ff7257fe..24529759d9 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php @@ -42,7 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-browser.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], + locationAuth: ['Project', 'ImpersonateUserId'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php index 15e558e345..28149b3945 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php @@ -42,7 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-credit-card.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], + locationAuth: ['Project', 'ImpersonateUserId'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php index a284ff8ef3..de02f59873 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php @@ -54,7 +54,7 @@ class Get extends Action description: '/docs/references/avatars/get-favicon.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], + locationAuth: ['Project', 'ImpersonateUserId'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php index e0834726da..7f32cdaa45 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php @@ -42,7 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-flag.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], + locationAuth: ['Project', 'ImpersonateUserId'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php index f8a2c90b89..ad4ed2ff37 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php @@ -45,7 +45,7 @@ class Get extends Action description: '/docs/references/avatars/get-image.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], + locationAuth: ['Project', 'ImpersonateUserId'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php index a10bed6bd8..4808cb7267 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php @@ -44,7 +44,7 @@ class Get extends Action description: '/docs/references/avatars/get-initials.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], + locationAuth: ['Project', 'ImpersonateUserId'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php index c135678489..ac08e060f2 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php @@ -42,7 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-qr.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], + locationAuth: ['Project', 'ImpersonateUserId'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php index 13b120d9f9..15b9408616 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php @@ -57,7 +57,7 @@ class Get extends Action description: '/docs/references/avatars/get-screenshot.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], + locationAuth: ['Project', 'ImpersonateUserId'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php index d0e3195e9d..d6475b4914 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php @@ -53,7 +53,7 @@ class Get extends Action ], contentType: ContentType::ANY, type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], + locationAuth: ['Project', 'ImpersonateUserId'], )) ->param('functionId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Function ID.', false, ['dbForProject']) ->param('deploymentId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Deployment ID.', false, ['dbForProject']) diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php index c13c67427f..6fbafd908b 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php @@ -51,7 +51,7 @@ class Get extends Action ) ], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], + locationAuth: ['Project', 'ImpersonateUserId'], contentType: ContentType::ANY, )) ->param('siteId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Site ID.', false, ['dbForProject']) diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php index 35e3b580fd..160fd30c37 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php @@ -58,7 +58,7 @@ class Get extends Action ], contentType: ContentType::ANY, type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], + locationAuth: ['Project', 'ImpersonateUserId'], )) ->param('bucketId', '', new UID(), 'Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') ->param('fileId', '', new UID(), 'File ID.') diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php index 0474630b40..2a2686b544 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php @@ -71,7 +71,7 @@ class Get extends Action ) ], type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], + locationAuth: ['Project', 'ImpersonateUserId'], contentType: ContentType::IMAGE )) ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php index c12b6d1aff..4ff3360eab 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php @@ -59,7 +59,7 @@ class Get extends Action ], contentType: ContentType::ANY, type: MethodType::LOCATION, - locationAuth: ['Project', 'ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'], + locationAuth: ['Project', 'ImpersonateUserId'], )) ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') ->param('fileId', '', new UID(), 'File ID.')