Skip auth on platform-DB project update for policies write

The platform 'projects' collection has document-level permissions
restricted to team-owner roles. The migration worker has no team
context, so the updateDocument call was being silently rejected by
the authorization validator — the migration reported success because
no exception bubbled up, but the destination project's auths attribute
was left unchanged.

Match the upstream Policies/Labels controllers' pattern by wrapping the
write in $dbForPlatform->getAuthorization()->skip(...).
This commit is contained in:
Prem Palanisamy committed 2026-05-19 17:40:16 +01:00
1 parent e998c64a7e
commit 83341566bf
1 file changed
+5 -2
+5 -2
View File
@@ -3411,11 +3411,14 @@ class Appwrite extends Destination
$auths['membershipsMfa'] = $resource->getMembershipsUserMfa();
$auths['membershipsUserPhone'] = $resource->getMembershipsUserPhone();
$this->dbForPlatform->updateDocument(
// The projects document is restricted to team-owner role on update;
// we're running in the migration worker which has no team context, so
// skip authorization the same way the upstream policy controllers do.
$this->dbForPlatform->getAuthorization()->skip(fn () => $this->dbForPlatform->updateDocument(
'projects',
$this->projectId,
new UtopiaDocument(['auths' => $auths]),
);
));
$this->dbForPlatform->purgeCachedDocument('projects', $this->projectId);