Details
-
Bug
-
Resolution: Fixed
-
Medium
-
4.5.1
-
Ibexa Open Source
-
Yes
Description
A command that is destined to render content fields will fail in case of one field being rich text field with embedded content due to https://github.com/ibexa/fieldtype-richtext/blob/main/src/lib/RichText/Renderer.php#L463 (lack of session and given user).
An idea to solve this would be to allow some kind of sudo or use `PermissionResolver` with `can` instead.
Steps to reproduce:
- Create an Article with a RichText field and embed any content into it.
- Create a new Symfony command with the following body:
protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); $content = $this->repository->getContentService()->loadContent(67); //ID of Article content $io->section($this->fieldRenderingExtension->renderField($content, 'title')); $body = $this->repository->sudo( function () use ($content) { return $this->fieldRenderingExtension->renderField($content, 'intro'); } ); $io->section($body); return Command::SUCCESS; }
- Run the command.
Result:
The command finishes with the exception:
An exception has been thrown during the rendering of a template ("The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL.")
in "@IbexaFieldTypeRichText/RichText/content_fields.html.twig".
Expected result:
The command should render the RichText field in the console properly.
Designs
Attachments
Issue Links
- relates to
-
IBX-6485 Provide patch for issue IBX-6217 on V3.3
- Closed