mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
refactor: use Query security scheme variants for impersonation on LOCATION methods
This commit is contained in:
1 parent
55d3af2f59
commit
18dfaedc37
3 files changed
+56
-4
No files matched your search
@@ -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',
|
||||
],
|
||||
'ImpersonateUserIdQuery' => [
|
||||
'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',
|
||||
],
|
||||
'ImpersonateUserIdQuery' => [
|
||||
'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',
|
||||
],
|
||||
'ImpersonateUserIdQuery' => [
|
||||
'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',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -385,9 +385,8 @@ class OpenAPI3 extends Format
|
||||
|
||||
$temp['x-appwrite']['auth'] = array_slice($securities, 0, $this->authCount);
|
||||
|
||||
// Impersonation falls back to query params for location-type methods (browsers can't set headers on resource URLs)
|
||||
if ($sdk->getType() === MethodType::LOCATION) {
|
||||
foreach (['ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'] as $key) {
|
||||
foreach (['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'] as $key) {
|
||||
if (\array_key_exists($key, $this->keys)) {
|
||||
$securities[$key] = [];
|
||||
$temp['x-appwrite']['auth'][$key] = [];
|
||||
|
||||
@@ -375,9 +375,8 @@ class Swagger2 extends Format
|
||||
|
||||
$temp['x-appwrite']['auth'] = \array_slice($securities, 0, $this->authCount);
|
||||
|
||||
// Impersonation falls back to query params for location-type methods (browsers can't set headers on resource URLs)
|
||||
if ($sdk->getType() === MethodType::LOCATION) {
|
||||
foreach (['ImpersonateUserId', 'ImpersonateUserEmail', 'ImpersonateUserPhone'] as $key) {
|
||||
foreach (['ImpersonateUserIdQuery', 'ImpersonateUserEmailQuery', 'ImpersonateUserPhoneQuery'] as $key) {
|
||||
if (\array_key_exists($key, $this->keys)) {
|
||||
$securities[$key] = [];
|
||||
$temp['x-appwrite']['auth'][$key] = [];
|
||||
|
||||
Reference in new issue
Block a user