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-31783: Fixed embedding Content with read permissions #1441

Merged
merged 5 commits into from Sep 24, 2020

Conversation

SerheyDolgushev
Copy link
Contributor

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

Checklist:

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

$contentTypeService
);

$this->restrictedContentTypesIdentifiers = count($restrictedContentTypes) ? $restrictedContentTypes : null;
Copy link
Contributor

@ViniTou ViniTou Sep 10, 2020

Choose a reason for hiding this comment

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

doc states that this is array, but you are assigning null here.
I Would also say that empty make intention more clear than count.

Also if possible, typehint array in more specific manner, like string[] in that case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ViniTou requested change is implemented in 1c54cff

Copy link
Contributor

@mikadamczyk mikadamczyk left a comment

Choose a reason for hiding this comment

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

This should go to 2.1 or, if it is possible, to 1.5. If this is a bug it should go to 1.5

@alongosz alongosz changed the title EZP-31783: As an Editor, I want to be able to link the content which I have read access to EZP-31783: Fixed embedding Content with read permissions Sep 10, 2020
@alongosz
Copy link
Member

Side remark @SerheyDolgushev, Story pattern "As an Editor..." applies to... stories, not bugs. This is really confusing, because Stories apply to master only.
I've changed for you JIRA title and changed PR title to reflect in the past (because it goes in 1:1 to git history) what changed with respect to current codebase. Or at least I tried, because I don't have full understanding of what happens here yet.

@SerheyDolgushev
Copy link
Contributor Author

This should go to 2.1 or, if it is possible, to 1.5. If this is a bug it should go to 1.5

Sorry, but personally I think it should go to 1.5. @mikadamczyk @alongosz @ViniTou are you ok with it?

@lserwatka
Copy link
Member

Yes, we can merge it to 1.5

@SerheyDolgushev
Copy link
Contributor Author

@lserwatka rebased on 1.5

return [];
}

$restrictedContentTypes = $contentTypeService->loadContentTypeList($restrictedContentTypesIds);
Copy link
Member

Choose a reason for hiding this comment

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

Have you tested this with weak user with no permissions to content type/read (or class/read legacy speaking)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This PR is deployed on a few large projects. And no issues were reported there. But I`m not sure exactly this case was tested. I hope your QA will check all edge cases (like this).

Comment on lines 68 to 70
return array_values(array_map(function (ContentType $contentType): string {
return $contentType->identifier;
}, (array)$restrictedContentTypes));
Copy link
Member

Choose a reason for hiding this comment

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

please re-format this code, it's not readable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, can you please suggest a more readable option?

Copy link
Contributor

Choose a reason for hiding this comment

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

        return array_values(
            array_map(static function (ContentType $contentType): string {
                return $contentType->identifier;
            },
            iterator_to_array($restrictedContentTypes)
        );

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done: 502ce9c


$restrictedContentTypes = $contentTypeService->loadContentTypeList($restrictedContentTypesIds);

return array_values(array_map(function (ContentType $contentType): string {
Copy link
Member

Choose a reason for hiding this comment

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

I don't see any reason not to:

Suggested change
return array_values(array_map(function (ContentType $contentType): string {
return array_values(array_map(static function (ContentType $contentType): string {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 0e3c6cf.

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 2.5 with diff.

@lserwatka lserwatka merged commit 81de433 into ezsystems:1.5 Sep 24, 2020
@lserwatka
Copy link
Member

@adamwojs could you merge it up?

@adamwojs
Copy link
Member

Done @lserwatka. Thank you for contribution @SerheyDolgushev!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
7 participants