-
Notifications
You must be signed in to change notification settings - Fork 60
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-30470: Filtered Content Types and Languages in ContentCreate widget based on user permissions #987
Conversation
c80e148
to
9bc4e4e
Compare
src/lib/Form/Type/ChoiceList/Loader/ContentCreateContentTypeChoiceLoader.php
Outdated
Show resolved
Hide resolved
src/lib/Form/Type/ChoiceList/Loader/ContentCreateLanguageChoiceLoader.php
Outdated
Show resolved
Hide resolved
d2c2256
to
eeefb91
Compare
All checks have passed https://travis-ci.org/ezsystems/ezplatform-admin-ui/jobs/531696714 |
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.
I see a huge problem here. In order to get list of restricted content types you need to load all content types. This happens in two places: in ContentCreateType
and ContentRightSidebarBuilder
. Full list of content types is also loaded by ContentTypeChoiceLoader
because it's wrapping another choice loader.
It can cause a huge impact on Persistence cache layer. I'm not sure if this is possible to avoid but it looks like you don't need to wrap ContentTypeChoiceLoader
just create new one that will load only needed content types.
* | ||
* @throws \EzSystems\EzPlatformAdminUi\Exception\InvalidArgumentException | ||
*/ | ||
public function getGroupedFlattenedLimitationsValues( |
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.
Name itself suggests that it should be split into smaller methods :)
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.
I agree that the name of this method was missed
@webhdx I think we have an in-memory cache for Content Types. For the user with a broad set of allowed CT it would be not efficient to load CT, and then fetch ContentTypesGroups for them. Also in this PR, in
we only filter existing list
and then
also as @alongosz said #987 (comment) we can do optimization as follow-up |
a501ae6
to
2ac38c6
Compare
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 approve
… to those which the user has access
This PR provides better filtering od Content Types and Languages in the content create widget. It depends on new method
\eZ\Publish\SPI\Limitation\Target\Version::createFromAnyContentTypeOf
. It also introduces new method in\EzSystems\EzPlatformAdminUi\Permission\PermissionCheckerInterface::getContentCreateLimitations
to get Limitations specificaly for Content creation.Checklist:
$ composer fix-cs
)