Extract getAPIKeyScopes() from generateAPIKey() for cloud extensibility

This commit is contained in:
Prem Palanisamy
2026-03-11 21:44:49 +00:00
parent 2ef7ef91b4
commit 3fcc9ef7b0
+34 -28
View File
@@ -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;