Skip to content
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

EZP-30978: fix issue when location limitation is used on content/edit policy #2780

Closed

Conversation

erdnaxelaweb
Copy link
Contributor

@erdnaxelaweb erdnaxelaweb commented Sep 26, 2019

Question Answer
JIRA issue EZP-30978
Bug/Improvement yes
New feature no
Target version 7.x
BC breaks no
Tests pass yes
Doc needed no

https://jira.ez.no/browse/EZP-30978

TODO:

  • Implement feature / fix a bug.
  • Implement tests.
  • Fix new code according to Coding Standards ($ composer fix-cs).
  • Ask for Code Review.

@erdnaxelaweb
Copy link
Contributor Author

erdnaxelaweb commented Sep 27, 2019

Thx @mikadamczyk
I have gone a bit overboard after taking the subtree limitation as an exemple.
Reverted some modification to only keep what is need to fix the original issue.

Copy link
Member

@alongosz alongosz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add an integration test for the use case so we can all understand what is the setup which causes this issue. It can be created either in \eZ\Publish\API\Repository\Tests\PermissionResolverTest or in \eZ\Publish\API\Repository\Tests\Values\User\Limitation\LocationLimitationTest.

Moreover the solution needs to be changed so it applies to all Limitations (in a generic way), not just Location:

@@ -131,12 +134,16 @@ public function evaluate(APILimitationValue $value, APIUserReference $currentUse
);
}

$targets = array_filter($targets, function ($target) {
return !$target instanceof Version;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The actual bug exists in the implementation of \eZ\Publish\Core\Repository\Permission\PermissionResolver::lookupLimitations.
An instance of Target should be passed to TargetAwareType Limitation type only, which canUser takes into the account. The lookupLimitation method needs to behave the same way. // cc @mikadamczyk

While this fix works for LocationLimitation, there might be similar issues

Ref:

  • \eZ\Publish\SPI\Limitation\TargetAwareType,
  • \eZ\Publish\SPI\Limitation\Target.

@adamwojs
Copy link
Member

Closing PR as obsolete. eZ Platform 2.5 has reached EOM, so please reopen PR in ezsystems/ezplatform-kernel (bug fixes) or ibexa/core (features/improvements) if issue is still valid for v3.3 / v4.x and you are willing to work on it.

@adamwojs adamwojs closed this Apr 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 participants