From 893d45d9ea4d4adf71ab994d56be8df6c1c7d54a Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Thu, 14 May 2026 09:51:31 +0100 Subject: [PATCH] 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. --- src/Migration/Destinations/Appwrite.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Migration/Destinations/Appwrite.php b/src/Migration/Destinations/Appwrite.php index a97b57177c..3430d6f4c8 100644 --- a/src/Migration/Destinations/Appwrite.php +++ b/src/Migration/Destinations/Appwrite.php @@ -3151,7 +3151,14 @@ class Appwrite extends Destination try { $this->dbForPlatform->createDocument('keys', new UtopiaDocument([ '$id' => ID::unique(), - '$permissions' => $resource->getPermissions(), + // SDK's Key model doesn't expose $permissions, so we can't read the source doc's perms. + // Mirror appwrite/appwrite's createKey controller default — `dbForPlatform.keys` is + // gated by endpoint scope, not document perms, so this is the upstream invariant. + '$permissions' => [ + Permission::read(Role::any()), + Permission::update(Role::any()), + Permission::delete(Role::any()), + ], 'projectInternalId' => $this->projectInternalId, 'projectId' => $this->project, 'resourceInternalId' => $this->projectInternalId,