From ead39142cd79a150eafd10c96178faaab7c2ee04 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Fri, 5 Jun 2026 18:14:28 +0530 Subject: [PATCH] refactor: explicitly set locationAuth on all LOCATION methods, remove default --- src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php | 1 + src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php | 1 + src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php | 1 + src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php | 1 + src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php | 1 + src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php | 1 + src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php | 1 + src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php | 1 + .../Modules/Functions/Http/Deployments/Download/Get.php | 3 ++- .../Platform/Modules/Sites/Http/Deployments/Download/Get.php | 1 + .../Modules/Storage/Http/Buckets/Files/Download/Get.php | 3 ++- .../Modules/Storage/Http/Buckets/Files/Preview/Get.php | 1 + .../Platform/Modules/Storage/Http/Buckets/Files/View/Get.php | 3 ++- src/Appwrite/SDK/Method.php | 2 +- 14 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php index cc30f014bc..70f8a40e2c 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: ['ImpersonateUserIdQuery', '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..4cedbb42b1 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: ['ImpersonateUserIdQuery', '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..2dcb797f7a 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: ['ImpersonateUserIdQuery', '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..6b2b76bc2f 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: ['ImpersonateUserIdQuery', '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..9b7bee8be0 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: ['ImpersonateUserIdQuery', '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..0b6df2353f 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: ['ImpersonateUserIdQuery', '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..86315c7101 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: ['ImpersonateUserIdQuery', '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..33ebcd73ab 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: ['ImpersonateUserIdQuery', '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..b246ccb0dc 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: ['ImpersonateUserIdQuery', '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..13aa754d12 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: ['ImpersonateUserIdQuery', '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..22dcb3e3aa 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: ['ImpersonateUserIdQuery', '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..bee4798b9e 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: ['ImpersonateUserIdQuery', '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..ea228e2ebd 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: ['ImpersonateUserIdQuery', '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/SDK/Method.php b/src/Appwrite/SDK/Method.php index 97283dfb4a..ce793ee113 100644 --- a/src/Appwrite/SDK/Method.php +++ b/src/Appwrite/SDK/Method.php @@ -53,7 +53,7 @@ class Method protected string $desc = '', protected bool $public = true, protected string $projectAuth = 'Project', - protected array $locationAuth = ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'] + protected array $locationAuth = [] ) { $this->validateMethod($name, $namespace); $this->validateAuthTypes($auth);