-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IBX-7172: Fixed Repository Filtering by multiple ObjectStateId criteria #401
IBX-7172: Fixed Repository Filtering by multiple ObjectStateId criteria #401
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Foremost, please add an integration test case showing the issue.
...h/Core/Persistence/Legacy/Filter/CriterionQueryBuilder/Content/ObjectStateIdQueryBuilder.php
Outdated
Show resolved
Hide resolved
…ectstate permissions
Honestly, a bit unsure how you want that test. Didn't find a existing test I could reuse by just adding more fixture. So created a new test in 3271b67 |
eZ/Publish/API/Repository/Tests/Filtering/ContentFilteringTest.php
Outdated
Show resolved
Hide resolved
…r/Content/ObjectStateIdQueryBuilder.php Co-authored-by: Andrew Longosz <[email protected]>
…ectstate permissions
…ectstate permissions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, some minor tweaks are needed:
eZ/Publish/API/Repository/Tests/Filtering/ContentFilteringTest.php
Outdated
Show resolved
Hide resolved
eZ/Publish/API/Repository/Tests/Filtering/ContentFilteringTest.php
Outdated
Show resolved
Hide resolved
eZ/Publish/API/Repository/Tests/Filtering/ContentFilteringTest.php
Outdated
Show resolved
Hide resolved
….php Co-authored-by: Andrew Longosz <[email protected]>
Co-authored-by: Andrew Longosz <[email protected]>
…ple objectstate permissions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test looks very good. 👍
@@ -29,19 +29,21 @@ public function buildQueryConstraint( | |||
FilteringQueryBuilder $queryBuilder, | |||
FilteringCriterion $criterion | |||
): ?string { | |||
$tableAlias = uniqid('osl_'); | |||
|
|||
/** @var \eZ\Publish\API\Repository\Values\Content\Query\Criterion\ObjectStateId $criterion */ | |||
$queryBuilder | |||
->joinOnce( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider it as a non merge blocking comment:
Just a remark - if we will always generate custom table alias for each ObjectStateId
criteria, then it would make sense to switch into simpler QueryBuilder::join
, which does not contain additional checks against table uniqueness.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point.. Changed joinOnce()
into a join()
…h multiple objectstate permissions
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QA approved on IbexaDXP 3.3 experience.
v3.3
If user has policy with limitation on multiple object states, the api call for
$locationService->loadLocationChildren($location)
creates (eZ\Publish\Core\Persistence\Legacy\Filter\CriterionQueryBuilder\Content\ObjectStateIdQueryBuilder
) an incorrect sql for checking the object states.The sql looks as follows :
Obviously,
object_state_link.contentobject_state_id
cannot be equal both:dcValue5
and:dcValue6
at the same time.Instead the objet_state_link table should be joined once for each id and the sql should read:
Checklist:
$ composer fix-cs
).@ezsystems/engineering-team
).