Details
-
Bug
-
Resolution: Fixed
-
High
-
5.4.9
-
None
Description
A use statement is missing in following file: vendor/ezsystems/ezpublish-kernel/eZ/Bundle/EzPublishCoreBundle/FieldType/Page/PageService.php
try { $contentInfoObjects[] = $this->contentService->loadContentInfo($item->contentId); } catch (UnauthorizedException $e) { // If unauthorized, disregard block as "valid" and continue loading other blocks. }
The following statement needs to be added to make the catch work:
use eZ\Publish\Core\Base\Exceptions\UnauthorizedException;
Step to reproduce:
1. Create the following content structure:
Home Tests (location_id: 122, object_id: 120) Article 1 (location_id: 123, object_id: 121)
2. Create a new section ("Test Section") and assign it to /Home/Tests/;
3. Edit ezpublish_legacy/settings/override/block.ini.append.php and create a standard manual block:
[General] AllowedTypes[]=Manual3Items [Manual3Items] Name=3 Column News NumberOfValidItems=3 NumberOfArchivedItems=5 ManualAddingOfItems=enabled ViewList[]=3_items1 ViewName[3_items1]=3 articles in one column
4. Edit the existing "Home" node, which is a "Landing Page" ContentType;
5. Add a new custom block of type "3 Column News" to an existing zone e.g. left;
6. Add an existing content to the new custom block. In this test, used /Getting Started/Resources/eZ Publish Tutorials, which is an article that is installed with demo content. It belongs to the "standard" section, and as such, is visible to anonymous users with standard roles and policies;
7. Also add "/Home/Tests/Article 1" to the new custom block;
8. Publish;
9. Try to access the above content on the frontend as an anonymous user.
Results:
- In "Prod" environment: the "3 Column News" section was not displayed at all, and also no errors were generated;
- In "Dev" environment: got this exception:
An exception has been thrown during the rendering of a template ("User does not have access to 'read' 'content' with: contentId '121'"). 500 Internal Server Error - Twig_Error_Runtime 1 linked Exception: UnauthorizedException ยป