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
EZP-31783: Fixed embedding Content with read permissions #1441
Conversation
$contentTypeService | ||
); | ||
|
||
$this->restrictedContentTypesIdentifiers = count($restrictedContentTypes) ? $restrictedContentTypes : null; |
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.
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.
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.
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.
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
Side remark @SerheyDolgushev, Story pattern "As an Editor..." applies to... stories, not bugs. This is really confusing, because Stories apply to master only. |
src/lib/UniversalDiscovery/Event/Subscriber/RichTextEmbedAllowedContentTypes.php
Outdated
Show resolved
Hide resolved
Sorry, but personally I think it should go to |
Yes, we can merge it to 1.5 |
1c54cff
to
b3d9ac4
Compare
@lserwatka rebased on |
return []; | ||
} | ||
|
||
$restrictedContentTypes = $contentTypeService->loadContentTypeList($restrictedContentTypesIds); |
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.
Have you tested this with weak user with no permissions to content type/read
(or class/read
legacy speaking)?
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.
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).
return array_values(array_map(function (ContentType $contentType): string { | ||
return $contentType->identifier; | ||
}, (array)$restrictedContentTypes)); |
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.
please re-format this code, it's not readable
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.
Sorry, can you please suggest a more readable option?
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.
return array_values(
array_map(static function (ContentType $contentType): string {
return $contentType->identifier;
},
iterator_to_array($restrictedContentTypes)
);
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.
Done: 502ce9c
|
||
$restrictedContentTypes = $contentTypeService->loadContentTypeList($restrictedContentTypesIds); | ||
|
||
return array_values(array_map(function (ContentType $contentType): string { |
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 don't see any reason not to:
return array_values(array_map(function (ContentType $contentType): string { | |
return array_values(array_map(static function (ContentType $contentType): string { |
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.
Done in 0e3c6cf.
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 approved on eZPlatform-ee 2.5 with diff.
@adamwojs could you merge it up? |
Done @lserwatka. Thank you for contribution @SerheyDolgushev! |
Checklist:
$ composer fix-cs
)