Allow permission reset
This commit is contained in:
parent
bfaf670b4e
commit
b69deb594d
1 changed files with 2 additions and 10 deletions
|
@ -535,20 +535,12 @@ App::patch('/v1/database/collections/:collectionId/documents/:documentId')
|
||||||
throw new Exception('No document found', 404);
|
throw new Exception('No document found', 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO check merge read write permissions
|
|
||||||
|
|
||||||
if (!empty($read)) { // Overwrite permissions only when passed
|
|
||||||
$data['$permissions']['read'] = $read;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($write)) { // Overwrite permissions only when passed
|
|
||||||
$data['$permissions']['write'] = $write;
|
|
||||||
}
|
|
||||||
|
|
||||||
$data = \array_merge($document->getArrayCopy(), $data);
|
$data = \array_merge($document->getArrayCopy(), $data);
|
||||||
|
|
||||||
$data['$collection'] = $collection->getId(); // Make sure user don't switch collectionID
|
$data['$collection'] = $collection->getId(); // Make sure user don't switch collectionID
|
||||||
$data['$id'] = $document->getId(); // Make sure user don't switch document unique ID
|
$data['$id'] = $document->getId(); // Make sure user don't switch document unique ID
|
||||||
|
$data['$permissions']['read'] = $read;
|
||||||
|
$data['$permissions']['write'] = $write;
|
||||||
|
|
||||||
if (empty($data)) {
|
if (empty($data)) {
|
||||||
throw new Exception('Missing payload', 400);
|
throw new Exception('Missing payload', 400);
|
||||||
|
|
Loading…
Reference in a new issue