-
Notifications
You must be signed in to change notification settings - Fork 204
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-30344: Allowed limiting Content management to specific translations #2585
Merged
alongosz
merged 9 commits into
ezsystems:master
from
alongosz:ezp-30344-language-limited-content-mgm
Apr 18, 2019
Merged
EZP-30344: Allowed limiting Content management to specific translations #2585
alongosz
merged 9 commits into
ezsystems:master
from
alongosz:ezp-30344-language-limited-content-mgm
Apr 18, 2019
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Mar 25, 2019
2 tasks
alongosz
force-pushed
the
ezp-30344-language-limited-content-mgm
branch
4 times, most recently
from
April 3, 2019 14:00
e15470c
to
b1d2838
Compare
alongosz
changed the title
EZP-30344: Implemented Translation Limitation
EZP-30344: Improved Language Limitation
Apr 4, 2019
alongosz
changed the title
EZP-30344: Improved Language Limitation
EZP-30344: Allowed limiting Content management to specific translations
Apr 4, 2019
alongosz
force-pushed
the
ezp-30344-language-limited-content-mgm
branch
from
April 4, 2019 15:46
b1d2838
to
01a240a
Compare
alongosz
requested review from
ViniTou,
adamwojs,
andrerom,
mikadamczyk,
Nattfarinn,
pawbuj and
webhdx
April 4, 2019 15:50
adamwojs
reviewed
Apr 5, 2019
eZ/Publish/API/Repository/Values/User/LookupLimitationResult.php
Outdated
Show resolved
Hide resolved
@mikadamczyk refactored to use VersionBuilder according to @adamwojs request. For changed usages please see 6217d1568 (hint: see extra |
alongosz
force-pushed
the
ezp-30344-language-limited-content-mgm
branch
from
April 9, 2019 22:00
9e61496
to
15cd9b6
Compare
ViniTou
reviewed
Apr 10, 2019
ViniTou
reviewed
Apr 10, 2019
ViniTou
reviewed
Apr 10, 2019
ViniTou
approved these changes
Apr 10, 2019
Fixed code review issues and added more flexibility to |
Improved implementation takes care about a target which describes future intended changes to a Content item
Instance of Target provides to TargetAwareLimitationType better target which describes the actual intent which cannot be inferred from a content item itself changed canUser invocation for: * createContentDraft * updateContent * publishVersion
alongosz
force-pushed
the
ezp-30344-language-limited-content-mgm
branch
from
April 12, 2019 11:25
c67e9d3
to
f0c45ea
Compare
micszo
approved these changes
Apr 17, 2019
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.
Closed
4 tasks
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
7.5.1
for eZ Platform2.5.1 LTS
Summary
This PR:
Language
Limitation by limiting user's ability to create, edit and publish content in a given language to a list of translations set by that Limitation.PermissionResolver::lookupLimitations
which provides more standardized and API-oriented way to fetch information about existing Limitations for the given object in the context of the given policy (by @mikadamczyk).Squashed into one PR due to time constraints.
Implementation details
Many Limitations throw exception when dealing with unknown objects or targets, which makes it impossible to set some specific mixes of Limitations on a given policy. This had hit us in the past and now makes current changes impossible to implement.
To solve this issue we're introducing two new interfaces:
\eZ\Publish\SPI\Limitation\Target
which is a marker for a newTarget
object which is designed in a new way and provides more information about an intent of acanUser
check.\eZ\Publish\SPI\Limitation\TargetAwareType
for LimitationType (service which implements Limitation evaluation logic) which does not throw exception when dealing with an unknown object. Such LimitationType should at the end returnACCESS_ABSTAIN
.TargetAwareType
LimitationType expects$targets
to be an array of instances ofTarget
, however if different object is passed, it won't throw exception (behaves as described).We've created the first class which objects follows the described behavior:
\eZ\Publish\SPI\Limitation\Target\Version
and a builder for DX and readability
\eZ\Publish\SPI\Limitation\Target\Builder\VersionBuilder
which provides behavioral, intent-driven API.
Consider the following
updateContent
use case:it checks if a user is able to edit the Content if new Version would contain new initial language and given fields (actually used only to extract language codes of modified translation).
Limitation\Target\Version
is passed as one of the targets to the followingContentService
methods:createContentDraft
// from existing VersionupdateContent
// not neededpublishVersion
We could try handling
ContentUpdateStruct
, but thisTarget
is also designed to provide Limitation lookup for which creating artificial update struct is an overkill.To provide BC for existing Limitations other than
Language
and avoid known issues when mixing Limitations for a single policy, the logic ofPermissionResolver::canUser
is changed as follows:Limitation\TargetAwareType
only targets which are not instances ofLimitation\Target
are passed (array is filtered prior passing). If an array is empty,null
is returned as some Limitations rely on that.Limitation\TargetAwareType
) only targets which are instances ofLimitation\Target
are passed.TODO:
$ composer fix-cs
).