Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

EZP-31742: UDW error for users with restricted content types #1432

Conversation

SerheyDolgushev
Copy link
Contributor

@SerheyDolgushev SerheyDolgushev commented Jul 15, 2020

Question Answer
Tickets https://jira.ez.no/browse/EZP-31742
Bug fix? yes
New feature? no
BC breaks? no
Tests pass? yes
Doc needed? no
License GPL-2.0

Steps to reproduce:

  1. Install clean eZ Platform 3.1.0/3.0.5.
  2. Modify editor user role (https://ezplatform310.localhost/admin/role/3):
    • Remove "Content / All functions" limitation
    • Add "Content / Read, Content Type: Folder" limitation
    • Add "Content / Create, Content Type: Folder" limitation
  3. Create a test editor user.
  4. Login into admin using test editor user credentials.
  5. Open "Content Structure" page (https://ezplatform310.localhost/admin/view/content/1/full/1/2).
  6. Click "Browse" button in the left menu (div.ez-sticky-container).

Expected result:
UDW is opened

Actual result:
JavaScript error is throw in the browser console

So UDF has serious issues for the users with "Content Type" limitation on "Content / Create" policy. And it is reproducible in OE as well.

Checklist:

  • Coding standards ($ composer fix-cs)
  • Ready for Code Review

@ViniTou ViniTou requested a review from a team July 16, 2020 06:47
Copy link
Contributor

@ViniTou ViniTou left a comment

Choose a reason for hiding this comment

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

But I would also like opinion from frontend, just to be sure ;)

Thrown exception is allowedContentTypes.includes is not a function, and its true, in UDW config instead of array of contentTypes there is Object/HashMap with numerical keys. Thing is where we should be consistent about types, in php those two thins (array - hashMap) are the same thing. Should we always reindex before returning to frontend or maybe you should try to always cast them to array. Or just to be sure, both as we can not relay on some common contract?
@dew326

@dew326
Copy link
Member

dew326 commented Jul 17, 2020

I think it depends what frontend expects, we are not able to make some general rule.
Here is a list of properties with types required by UDW: https://github.com/ezsystems/ezplatform-admin-ui/blob/master/src/bundle/ui-dev/src/modules/universal-discovery/universal.discovery.module.js#L364

@ViniTou ViniTou requested a review from a team July 17, 2020 06:38
@tomaszszopinski tomaszszopinski self-assigned this Jul 17, 2020
Copy link
Contributor

@tomaszszopinski tomaszszopinski left a comment

Choose a reason for hiding this comment

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

QA approved on eZPlatform ee 3.0.5 with diff.

@lserwatka lserwatka merged commit 8c52272 into ezsystems:2.0 Jul 21, 2020
@lserwatka
Copy link
Member

@ViniTou could you merge it up?

# for free to join this conversation on GitHub. Already have an account? # to comment
Development

Successfully merging this pull request may close these issues.

5 participants