Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-29959

Token not found exception in ContentViewBuilder when used to build own exception page

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Medium Medium
    • Resolution: Fixed
    • Affects Version/s: 1.7.8, 1.13.4, 2.2.3, 2.3.2
    • Fix Version/s: 1.7.9, 1.13.5, 2.3.3, 2.4.1
    • Component/s: Permissions
    • Labels:
      None

      Description

      The issue happens in all cases when Symfony's Security Component has not been initialised yet, for instance, when any router throws exception.

      Steps to reproduce

      1. Create own ExceptionController
      2. Configure Twig to use custom ExceptionController

        config.yml

        twig:
            exception_controller: App\Controller\ExceptionController::showException
        

      3. In the custom controller try to render template. In template try to do:

         {{ render(controller('ez_content:viewLocation', {
        	'locationId': locationId,
        	'viewType': 'embed'
        })) }}
        

        where locationId is some existing location.

      4. You should see 500 error and exception like Token not found in token storage....

      Solution
      As discussed with Bertrand Dunogier and André Rømcke, ContentViewBuilder should use our PermissionResolver instead of Symfony's AuthorizationChecker.

        Activity

        Show
        Kamil Madejski added a comment - PR: https://github.com/ezsystems/ezpublish-kernel/pull/2510
        Show
        Marek Nocoń added a comment - Merged: https://github.com/ezsystems/ezpublish-kernel/commit/d6ebeca866491e1d343f496d5c415e7f50a7cc37 Additional PR: https://github.com/ezsystems/ezpublish-kernel/pull/2533 Merged: https://github.com/ezsystems/ezpublish-kernel/commit/1a013ad3681a3c5b151234310e926531368f2491

          People

          • Assignee:
            Unassigned
            Reporter:
            Kamil Madejski
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: