Skip to content

Commit 8353f1e

Browse files
committed
deleteDocuments skip auth
1 parent 5ac075d commit 8353f1e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Database/Database.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5395,7 +5395,7 @@ public function deleteDocuments(string $collection, array $queries = [], int $ba
53955395
throw new DatabaseException("Cursor document must be from the same Collection.");
53965396
}
53975397

5398-
$documents = $this->withTransaction(function () use ($collection, $queries, $batchSize, $limit, $cursor) {
5398+
$documents = $this->withTransaction(function () use ($collection, $queries, $batchSize, $limit, $cursor, $skipAuth, $authorization) {
53995399
$documents = [];
54005400
$originalLimit = $limit;
54015401
$lastDocument = $cursor;
@@ -5461,10 +5461,12 @@ public function deleteDocuments(string $collection, array $queries = [], int $ba
54615461
}
54625462

54635463
foreach (\array_chunk($documents, $batchSize) as $chunk) {
5464-
$this->adapter->deleteDocuments( // Do we need to check $skipAuth like in updateDocuments?
5464+
$callback = fn () => $this->adapter->deleteDocuments(
54655465
$collection->getId(),
54665466
array_map(fn ($document) => $document->getId(), $chunk)
54675467
);
5468+
5469+
$skipAuth ? $authorization->skip($callback) : $callback();
54685470
}
54695471

54705472
return $documents;

0 commit comments

Comments
 (0)