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

Public API - Defaut editor permissions not working correctly

    XMLWordPrintable

Details

    • Stetind Sprint 7

    Description

      Editor user permissions aren't working as expected.
      If we run the following script:

      public function testEditorPermissions()
      {
         $userService = $this->repo->getUserService();
       
      // create a new Editor User
         $newUser = $userService->newUserCreateStruct(
            "one",
            "one@one.com",
            "one",
            "eng-GB"
         );
         $newUser->setField( "first_name", "One" );
         $newUser->setField( "last_name", "One" );
         $user = $userService->createUser( $newUser, array($userService->loadUserGroup( 13 )) ); // 13 = editors
      // login with the recently created user
         $this->repo->setCurrentUser( $user );
      // make a folder
         $contentTypeService = $this->repo->getContentTypeService();
         $contentService = $this->repo->getContentService();
         $locationService = $this->repo->getLocationService();
         $newContent = $contentService->newContentCreateStruct( $contentTypeService->loadContentTypeByIdentifier( "folder" ), $this->api->lang );
         $newContent->setField( "name", "News");
          
      // make new location
         $newLocation = $locationService->newLocationCreateStruct( 2 ); // 2 = "/" (root)
       
      // save content and location
         $contentService->publishVersion(
            $contentService->createContent( $newContent, array( $newLocation ) )->getVersionInfo()
         );
      }
      

      We will get an error:

      eZ\Publish\Core\Base\Exceptions\UnauthorizedException: User does not have access to 'read' 'content'
      
      /var/www/apache2php53/ezp5/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Repository/ContentService.php:299
      /var/www/apache2php53/ezp5/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Repository/ContentService.php:1319
      /var/www/apache2php53/ezp5/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/SignalSlot/ContentService.php:416
      /var/www/apache2php53/ezp5/ezpublish_testsystem/extension/ezpublishapitests/tests/ezpublishapiexample.php:32   // publishVersion
      /var/www/apache2php53/ezp5/ezpublish_testsystem/extension/selenium/classes/ezpselenesetest.php:753
      /var/www/apache2php53/ezp5/ezpublish_testsystem/tests/toolkit/ezptestrunner.php:372
      
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            marcos.loureiro-obsolete@ez.no Marcos Loureiro (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 1 day Original Estimate - 1 day
                1d
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 days, 6 hours, 30 minutes
                4d 6h 30m