diff --git a/app/init/constants.php b/app/init/constants.php index b12d7997a6..ab62db5fc8 100644 --- a/app/init/constants.php +++ b/app/init/constants.php @@ -273,6 +273,7 @@ const APP_AUTH_TYPE_SESSION = 'Session'; const APP_AUTH_TYPE_JWT = 'JWT'; const APP_AUTH_TYPE_KEY = 'Key'; const APP_AUTH_TYPE_ADMIN = 'Admin'; +const APP_AUTH_TYPE_ORGANIZATION = 'Organization'; // Response related const MAX_OUTPUT_CHUNK_SIZE = 10 * 1024 * 1024; // 10MB const APP_LIMIT_UPLOAD_CHUNK_SIZE = 5 * 1024 * 1024; // 5MB diff --git a/src/Appwrite/Platform/Modules/Organization/Http/Projects/Create.php b/src/Appwrite/Platform/Modules/Organization/Http/Projects/Create.php index c2eeaa7f30..a57548a71b 100644 --- a/src/Appwrite/Platform/Modules/Organization/Http/Projects/Create.php +++ b/src/Appwrite/Platform/Modules/Organization/Http/Projects/Create.php @@ -54,7 +54,7 @@ class Create extends Action description: << 'Your secret API key', 'in' => 'header', ], + 'Organization' => [ + 'type' => 'apiKey', + 'name' => 'X-Appwrite-Organization', + 'description' => 'Your organization ID', + 'in' => 'header', + ], 'JWT' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-JWT', @@ -327,6 +333,12 @@ class Specs extends Action 'description' => 'Your secret API key', 'in' => 'header', ], + 'Organization' => [ + 'type' => 'apiKey', + 'name' => 'X-Appwrite-Organization', + 'description' => 'Your organization ID', + 'in' => 'header', + ], 'JWT' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-JWT', diff --git a/src/Appwrite/SDK/AuthType.php b/src/Appwrite/SDK/AuthType.php index 307b3cf35e..c272a49451 100644 --- a/src/Appwrite/SDK/AuthType.php +++ b/src/Appwrite/SDK/AuthType.php @@ -8,4 +8,11 @@ enum AuthType: string case KEY = APP_AUTH_TYPE_KEY; case SESSION = APP_AUTH_TYPE_SESSION; case ADMIN = APP_AUTH_TYPE_ADMIN; + + /** + * Scopes a request to an organization via the X-Appwrite-Organization + * header. Carries no platform of its own, so routes must still declare the + * auth types that make them reachable (ADMIN, KEY, ...). + */ + case ORGANIZATION = APP_AUTH_TYPE_ORGANIZATION; } diff --git a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php index 04095bc23b..04f18cbab6 100644 --- a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php @@ -86,6 +86,7 @@ class OpenAPI3 extends Format 'Project' => '', 'ProjectPath' => '', 'Key' => '', + 'Organization' => '', 'JWT' => '', 'Locale' => 'en', 'Mode' => '',