Skip to content

Commit b9d2a24

Browse files
committed
Uid change
1 parent 9898ed1 commit b9d2a24

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

src/Database/Database.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6170,6 +6170,12 @@ public function updateDocument(string $collection, string $id, Document $documen
61706170

61716171
$skipPermissionsUpdate = ($originalPermissions === $currentPermissions);
61726172
}
6173+
6174+
// UID change
6175+
if ($document->offsetExists('$id') && $document->getId() !== $id) {
6176+
$skipPermissionsUpdate = false;
6177+
}
6178+
61736179
$createdAt = $document->getCreatedAt();
61746180

61756181
$document = \array_merge($old->getArrayCopy(), $document->getArrayCopy());
@@ -6183,14 +6189,6 @@ public function updateDocument(string $collection, string $id, Document $documen
61836189
}
61846190
$document = new Document($document);
61856191

6186-
// A UID change re-keys the permission rows (_perms._document) to the
6187-
// new UID, so the permission block must run even when the permission
6188-
// set itself is unchanged. Otherwise the old rows are orphaned and the
6189-
// new UID is left with no permissions.
6190-
if ($document->getId() !== $id) {
6191-
$skipPermissionsUpdate = false;
6192-
}
6193-
61946192
$attributes = $collection->getAttribute('attributes', []);
61956193

61966194
$relationships = \array_filter($attributes, function ($attribute) {

0 commit comments

Comments
 (0)