1
0
Fork 0
mirror of synced 2024-05-20 20:52:36 +12:00

fix: migration

This commit is contained in:
Torsten Dittmann 2022-01-04 18:54:18 +01:00
parent 3e4e5a787d
commit 9c6e03c405

View file

@ -176,6 +176,7 @@ class V11 extends Migration
'$collection!=' . OldDatabase::SYSTEM_COLLECTION_PROJECTS,
'$collection!=' . OldDatabase::SYSTEM_COLLECTION_CONNECTIONS,
'$collection!=' . OldDatabase::SYSTEM_COLLECTION_RESERVED,
'$collection!=' . OldDatabase::SYSTEM_COLLECTION_TOKENS,
]
]);
@ -462,10 +463,19 @@ class V11 extends Migration
/*
* Migrate User providers settings
*/
foreach ($auths as $index => $auth) {
$enabled = $document->getAttribute('auth'.\ucfirst($auth['key']), true);
$newAuths['auth'.\ucfirst($auth['key'])] = $enabled;
$document->removeAttribute('auth'.\ucfirst($auth['key']));
$oldAuths = [
'email-password'=> 'usersAuthEmailPassword',
'magic-url' => 'usersAuthMagicURL',
'anonymous' => 'usersAuthAnonymous',
'invites' => 'usersAuthInvites',
'jwt' => 'usersAuthJWT',
'phone' => 'usersAuthPhone'
];
foreach ($oldAuths as $index => $auth) {
$enabled = $document->getAttribute(\ucfirst($auth), true);
$newAuths['auth'.\ucfirst($auths[$index]['key'])] = $enabled;
$document->removeAttribute(\ucfirst($auth));
}
if (!empty($document->getAttribute('usersAuthLimit'))) {
@ -560,6 +570,10 @@ class V11 extends Migration
$document->setAttribute('$read', ['role:all']);
$document->setAttribute('$write', ['role:all']);
break;
case OldDatabase::SYSTEM_COLLECTION_FUNCTIONS:
$document->setAttribute('events', $document->getAttribute('events', []));
break;
case OldDatabase::SYSTEM_COLLECTION_WEBHOOKS:
$projectId = $this->getProjectIdFromReadPermissions($document);
@ -571,6 +585,8 @@ class V11 extends Migration
$document->setAttribute('projectId', $projectId);
}
$document->setAttribute('events', $document->getAttribute('events', []));
/**
* Reset Permissions
*/