Skip to content

Commit a1e01bf

Browse files
committed
Fix delete draft with a published=false query
1 parent 44eca9b commit a1e01bf

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

features/publishable/publishable.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,6 @@ Feature: Access to unpublished/draft resources should be configurable
334334
When I send a "DELETE" request to the resource "publishable_draft" and the postfix "?published=false"
335335
Then the response status code should be 204
336336
And the resource "publishable_draft" should not exist
337-
And the resource "publishable_published" should exist
338337

339338
@loginUser
340339
Scenario: As a user which does not normally have draft access, I can delete a component where security groups are configured to allow it

src/Doctrine/Extension/ORM/PublishableExtension.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,9 @@ private function getDQL(Publishable $configuration, string $resourceClass): stri
119119

120120
private function isDraftRequest(string $resourceClass, array $context): bool
121121
{
122-
return $this->publishableStatusChecker->isGranted($resourceClass) && false === ($context['filters']['published'] ?? false);
122+
$isPublishedAsBoolean = filter_var($context['filters']['published'] ?? false, \FILTER_VALIDATE_BOOLEAN);
123+
124+
return $this->publishableStatusChecker->isGranted($resourceClass) && !$isPublishedAsBoolean;
123125
}
124126

125127
private function updateQueryBuilderForUnauthorizedUsers(QueryBuilder $queryBuilder, Publishable $configuration): void

0 commit comments

Comments
 (0)