Skip to content

Commit 893d45d

Browse files
committed
Restore Role::any() perms on migrated keys with rationale comment
SDK strips $permissions from Key responses so we can't copy from source; match the upstream createKey controller default since dbForPlatform.keys is gated by endpoint scope, not document perms.
1 parent 207ab82 commit 893d45d

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/Migration/Destinations/Appwrite.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3151,7 +3151,14 @@ protected function createApiKey(ApiKey $resource): bool
31513151
try {
31523152
$this->dbForPlatform->createDocument('keys', new UtopiaDocument([
31533153
'$id' => ID::unique(),
3154-
'$permissions' => $resource->getPermissions(),
3154+
// SDK's Key model doesn't expose $permissions, so we can't read the source doc's perms.
3155+
// Mirror appwrite/appwrite's createKey controller default — `dbForPlatform.keys` is
3156+
// gated by endpoint scope, not document perms, so this is the upstream invariant.
3157+
'$permissions' => [
3158+
Permission::read(Role::any()),
3159+
Permission::update(Role::any()),
3160+
Permission::delete(Role::any()),
3161+
],
31553162
'projectInternalId' => $this->projectInternalId,
31563163
'projectId' => $this->project,
31573164
'resourceInternalId' => $this->projectInternalId,

0 commit comments

Comments
 (0)