mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Extract getAPIKeyScopes() from generateAPIKey() for cloud extensibility
This commit is contained in:
@@ -286,6 +286,39 @@ class Migrations extends Action
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string>
|
||||
*/
|
||||
protected function getAPIKeyScopes(): array
|
||||
{
|
||||
return [
|
||||
'users.read',
|
||||
'users.write',
|
||||
'teams.read',
|
||||
'teams.write',
|
||||
'buckets.read',
|
||||
'buckets.write',
|
||||
'files.read',
|
||||
'files.write',
|
||||
'functions.read',
|
||||
'functions.write',
|
||||
'sites.read',
|
||||
'sites.write',
|
||||
'tokens.read',
|
||||
'tokens.write',
|
||||
'providers.read',
|
||||
'providers.write',
|
||||
'topics.read',
|
||||
'topics.write',
|
||||
'subscribers.read',
|
||||
'subscribers.write',
|
||||
'messages.read',
|
||||
'messages.write',
|
||||
'targets.read',
|
||||
'targets.write',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -302,34 +335,7 @@ class Migrations extends Action
|
||||
METRIC_NETWORK_INBOUND,
|
||||
METRIC_NETWORK_OUTBOUND,
|
||||
],
|
||||
'scopes' => [
|
||||
'users.read',
|
||||
'users.write',
|
||||
'teams.read',
|
||||
'teams.write',
|
||||
'buckets.read',
|
||||
'buckets.write',
|
||||
'files.read',
|
||||
'files.write',
|
||||
'functions.read',
|
||||
'functions.write',
|
||||
'sites.read',
|
||||
'sites.write',
|
||||
'tokens.read',
|
||||
'tokens.write',
|
||||
'providers.read',
|
||||
'providers.write',
|
||||
'topics.read',
|
||||
'topics.write',
|
||||
'subscribers.read',
|
||||
'subscribers.write',
|
||||
'messages.read',
|
||||
'messages.write',
|
||||
'targets.read',
|
||||
'targets.write',
|
||||
'policies.read',
|
||||
'policies.write',
|
||||
]
|
||||
'scopes' => $this->getAPIKeyScopes()
|
||||
]);
|
||||
|
||||
return API_KEY_DYNAMIC . '_' . $apiKey;
|
||||
|
||||
Reference in New Issue
Block a user