mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 17:08:45 +00:00
fix: api key migration
This commit is contained in:
parent
25c6673140
commit
3730e33b0c
1 changed files with 23 additions and 0 deletions
|
|
@ -510,6 +510,29 @@ class V11 extends Migration
|
|||
|
||||
break;
|
||||
case OldDatabase::SYSTEM_COLLECTION_KEYS:
|
||||
$projectId = $this->getProjectIdFromReadPermissions($document);
|
||||
|
||||
/**
|
||||
* Set Project ID
|
||||
*/
|
||||
if ($document->getAttribute('projectId') === null) {
|
||||
$document->setAttribute('projectId', $projectId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set scopes if empty
|
||||
*/
|
||||
if (empty($document->getAttribute('scopes', []))) {
|
||||
$document->setAttribute('scopes', []);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset Permissions
|
||||
*/
|
||||
$document->setAttribute('$read', ['role:all']);
|
||||
$document->setAttribute('$write', ['role:all']);
|
||||
|
||||
break;
|
||||
case OldDatabase::SYSTEM_COLLECTION_WEBHOOKS:
|
||||
$projectId = $this->getProjectIdFromReadPermissions($document);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue