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:
parent
37afb82d1c
commit
4113ae7ca5
1 changed files with 2 additions and 1 deletions
|
@ -3279,7 +3279,6 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/documents/:docum
|
||||||
$permissions = $document->getPermissions() ?? [];
|
$permissions = $document->getPermissions() ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = \array_merge($document->getArrayCopy(), $data);
|
|
||||||
$data['$collection'] = $collection->getId(); // Make sure user doesn't switch collectionID
|
$data['$collection'] = $collection->getId(); // Make sure user doesn't switch collectionID
|
||||||
$data['$createdAt'] = $document->getCreatedAt(); // Make sure user doesn't switch createdAt
|
$data['$createdAt'] = $document->getCreatedAt(); // Make sure user doesn't switch createdAt
|
||||||
$data['$id'] = $document->getId(); // Make sure user doesn't switch document unique ID
|
$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);
|
$checkPermissions($collection, $newDocument, $document, Database::PERMISSION_UPDATE);
|
||||||
|
|
||||||
|
$data = \array_merge($document->getArrayCopy(), $data);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$document = $dbForProject->withRequestTimestamp(
|
$document = $dbForProject->withRequestTimestamp(
|
||||||
$requestTimestamp,
|
$requestTimestamp,
|
||||||
|
|
Loading…
Reference in a new issue