1
0
Fork 0
mirror of synced 2024-07-04 06:00:53 +12:00

Allow updating document with read-only relationship

A user should be able to update a document without touching the
relationship.

Relates: https://github.com/appwrite/appwrite/issues/5404
This commit is contained in:
Steven Nguyen 2023-04-19 17:16:49 -07:00
parent 37afb82d1c
commit 4113ae7ca5
No known key found for this signature in database

View file

@ -3279,7 +3279,6 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/documents/:docum
$permissions = $document->getPermissions() ?? [];
}
$data = \array_merge($document->getArrayCopy(), $data);
$data['$collection'] = $collection->getId(); // Make sure user doesn't switch collectionID
$data['$createdAt'] = $document->getCreatedAt(); // Make sure user doesn't switch createdAt
$data['$id'] = $document->getId(); // Make sure user doesn't switch document unique ID
@ -3369,6 +3368,8 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/documents/:docum
$checkPermissions($collection, $newDocument, $document, Database::PERMISSION_UPDATE);
$data = \array_merge($document->getArrayCopy(), $data);
try {
$document = $dbForProject->withRequestTimestamp(
$requestTimestamp,