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

Permission versionread exception using Workflow for publishing

    XMLWordPrintable

Details

    Description

      Required configuration:
      1. In ezpublish.yml set your own controller and own template for rendering article ContentType, for e.g:

                  location_view:
                      full:
                          article:
                              controller: EzSystemsTestBundle:Default:article
                              template: EzSystemsTestBundle:Default:article.html.twig
                              match:
                                  Identifier\ContentType: [article]
      

      2. Your controller has to use locationService, for e.g.:

          public function articleAction($locationId, $viewType, $layout = false, $params = array())
          {
      
              $repository = $this->getRepository();
              $locationService = $repository->getLocationService();
              $location = $locationService->loadLocation($locationId);
      
      
              return $this->get('ez_content')->viewLocation(
                  $locationId,
                  $viewType,
                  $layout,
                  $params
              );
          }
      

      The goal is to use locationService->loadLocation() directly.
      3. Template isn't important.

      You need 3 separated incognito browser windows or even better, 3 separated browsers.
      Browser 1: Editor
      Browser 2: Admin
      Browser 3: Anonymous

      Steps to reproduce:
      1. Create new workflow (with a name for e.g: New Workflow): Event / Approve. Set Administrator user as Users who approve content and choose all sections, languages and versions.
      2. Configure Workflow trigger: content / publish / before and choose New Workflow.
      3. Log in as editor in browser 1. Create a new article (for e.g. Article A) and publish it.
      4. In browser 3, as anonymous go to the address: http://ezpublish.dev/Article-A. You should see Module not found message (404).
      5. In browser 2 log in as admin. Go to Dashboard -> Collaboration -> select previously created article -> Approve it.
      5. After approve, in browser 3, as anonymous go to the address: http://ezpublish.dev/Article-A. You should see Module not found message (404) again.
      6. Run php runcronjobs.php frequent from ezpublish_legacy directory. Run php ezpublish/console ezpublish:legacy:script runcronjobs.php frequent command.
      In the console, you should see confirmation, that the article was published.
      5. In the browser 3 go to this content directly (type URL manually, don't use breadcrumbs/menu etc.). You should see an article.
      6. As editor edit Article A and publish it.
      7. As administrator go to Collaboration again, and approve the modified article Article A.
      8. Run php runcronjobs.php frequent from ezpublish_legacy directory again. Run php ezpublish/console ezpublish:legacy:script runcronjobs.php frequent command again.
      9. In the browser 3 go to this content directly (type URL manually) as an anonymous user. You should see:
      a) exception*
      b) incorrect, old (previous, not current) version of the article

      *Exception:

      User does not have access to 'versionread' 'content' with: contentId '157', versionNo ''
      

      The exception is not appearing every time. Sometimes you will see just the previous version of the article.

      More information
      1. During tests, I noticed that when the issue is going to appear, then article is rendered with default template instead of this one defined in the ezpublish.yml

      Attachments

        Activity

          People

            Unassigned Unassigned
            kamil.madejski@ibexa.co Kamil Madejski
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: