diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php index 70f8a40e2c..6bb6731c04 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: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', '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 4cedbb42b1..304c47583b 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: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', '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 2dcb797f7a..89e9c73ab8 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: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', '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 6b2b76bc2f..11d3b50a99 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: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', '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 9b7bee8be0..64ced4cc68 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: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', '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 0b6df2353f..93ca892f6c 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: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', '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 86315c7101..67565220fc 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: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', '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 33ebcd73ab..cf6b5e2b0a 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: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', '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 b246ccb0dc..eb7d51921e 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: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', '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 13aa754d12..26987d145f 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: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', '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 22dcb3e3aa..e24b6819fa 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: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', '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 bee4798b9e..9c7c7ea1d1 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: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', '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 ea228e2ebd..a0f2d3a0bc 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: ['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'], + locationAuth: ['Project', '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 ce793ee113..e364c96163 100644 --- a/src/Appwrite/SDK/Method.php +++ b/src/Appwrite/SDK/Method.php @@ -32,8 +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 Additional security scheme keys injected for location-type methods + * @param array $locationAuth Security scheme keys injected for location-type methods (includes project auth) */ public function __construct( protected string $namespace, @@ -52,17 +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); @@ -233,7 +227,7 @@ class Method public function getProjectAuth(): string { - return $this->projectAuth; + return $this->locationAuth[0] ?? 'Project'; } public function getLocationAuth(): array