1
0
Fork 0
mirror of synced 2024-05-20 12:42:39 +12:00

fix: api key migration

This commit is contained in:
Torsten Dittmann 2021-12-31 14:40:38 +01:00
parent 25c6673140
commit 3730e33b0c

View file

@ -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);