Skip to content

Commit

Permalink
Update Authorisation Validator
Browse files Browse the repository at this point in the history
  • Loading branch information
PineappleIOnic committed Sep 17, 2024
1 parent 0fe42d5 commit c3115b5
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Database/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -5012,15 +5012,14 @@ public function deleteDocuments(string $collection, array $queries = [], int $ba
}

foreach ($affectedDocuments as $document) {
$validator = new Authorization(self::PERMISSION_DELETE);

if ($collection->getId() !== self::METADATA) {
$documentSecurity = $collection->getAttribute('documentSecurity', false);
if (!$validator->isValid([
$isValid = $this->authorization->isValid(new Input(self::PERMISSION_DELETE, [
...$collection->getDelete(),
...($documentSecurity ? $document->getDelete() : [])
])) {
throw new AuthorizationException($validator->getDescription());
]));
if (!$isValid) {
throw new AuthorizationException($this->authorization->getDescription());
}
}

Expand Down

0 comments on commit c3115b5

Please sign in to comment.