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

API: Issues with create permission with Section limitation

    XMLWordPrintable

Details

    Description

      This issue describes some different behaviors, which may or may not be related.

      In some situations, unexpected errors will be thrown when dealing with the Public API + permission limitations.

      Example 1:

      1. For the Anonymous role, add the following policies/limitations, through the legacy admin interface (module/function, limitation[s]):

      • content/create, Section( Standard )
      • content/edit, Section( Standard )
      • content/read, No limitations
      • user/login, SiteAccess ( frontend )
      • user/register, No limitations

      2. Through the PAPI (in a controller action), create a content object within the Standard section.
      3. The following error is displayed: "User does not have access to 'create' 'content'" error.

      in /var/www/ezp/500-ezp/vendor/ezsystems/ezpublish/eZ/Publish/Core/Repository/ContentService.php at line 440    
      at ContentService ->createContent (object(ContentCreateStruct), array(object(LocationCreateStruct))) 
      in /var/www/ezp/500-ezp/vendor/ezsystems/ezpublish/eZ/Publish/Core/SignalSlot/ContentService.php at line 237    
      at ContentService ->createContent (object(ContentCreateStruct), array(object(LocationCreateStruct))) 
      in /var/www/ezp/500-ezp/src/EzSystems/DemoBundle/Controller/DemoController.php at line 40    
      at DemoController ->whatAction () 
      at call_user_func_array (array(object(DemoController), 'whatAction'), array()) 
      in /var/www/ezp/500-ezp/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php at line 129    
      at HttpKernel ->handleRaw (object(Request), '1') 
      in /var/www/ezp/500-ezp/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php at line 73    
      at HttpKernel ->handle (object(Request), '1', true) 
      in /var/www/ezp/500-ezp/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/HttpKernel.php at line 51    
      at HttpKernel ->handle (object(Request), '1', true) 
      in /var/www/ezp/500-ezp/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php at line 193    
      at Kernel ->handle (object(Request), '1', true) 
      in /var/www/ezp/500-ezp/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php at line 447    
      at HttpCache ->forward (object(Request), true, null) 
      in /var/www/ezp/500-ezp/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php at line 60    
      at HttpCache ->forward (object(Request), true) 
      in /var/www/ezp/500-ezp/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php at line 416    
      at HttpCache ->fetch (object(Request), true) 
      in /var/www/ezp/500-ezp/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php at line 316    
      at HttpCache ->lookup (object(Request), true) 
      in /var/www/ezp/500-ezp/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php at line 193    
      at HttpCache ->handle (object(Request)) 
      in /var/www/ezp/500-ezp/web/index.php at line 28    
      

      Example 2:

      1. For the Anonymous role, add the following policies/limitations through the legacy admin interface:

      • content/create, Node( Home )
      • content/edit, Node( Home )
      • content/read, No limitations
      • user/login, SiteAccess ( frontend )
      • user/register, No limitations

      2. Through the PAPI (in a controller action), create a content object, in the Home node
      3. The following error is displayed: Argument '$contentInfo' has a bad state: ContentInfo has no published versions

      Stack trace:

      in /var/www/ezp/500-ezp/vendor/ezsystems/ezpublish/eZ/Publish/Core/Repository/LocationService.php at line 256    
      at LocationService ->loadLocations (object(ContentInfo)) 
      in /var/www/ezp/500-ezp/vendor/ezsystems/ezpublish/eZ/Publish/Core/Limitation/LocationLimitationType.php at line 141    
      at LocationLimitationType ->evaluate (object(LocationLimitation), object(Repository), object(Content), null) 
      in /var/www/ezp/500-ezp/vendor/ezsystems/ezpublish/eZ/Publish/Core/Repository/Repository.php at line 347    
      at Repository ->canUser ('content', 'edit', object(Content)) 
      in /var/www/ezp/500-ezp/vendor/ezsystems/ezpublish/eZ/Publish/Core/Repository/ContentService.php at line 1251    
      at ContentService ->publishVersion (object(VersionInfo)) 
      in /var/www/ezp/500-ezp/vendor/ezsystems/ezpublish/eZ/Publish/Core/SignalSlot/ContentService.php at line 416    
      at ContentService ->publishVersion (object(VersionInfo)) 
      in /var/www/ezp/500-ezp/src/EzSystems/DemoBundle/Controller/DemoController.php at line 41    
      at DemoController ->whatAction () 
      at call_user_func_array (array(object(DemoController), 'whatAction'), array()) 
      in /var/www/ezp/500-ezp/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php at line 129    
      at HttpKernel ->handleRaw (object(Request), '1') 
      in /var/www/ezp/500-ezp/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php at line 73    
      at HttpKernel ->handle (object(Request), '1', true) 
      in /var/www/ezp/500-ezp/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/HttpKernel.php at line 51    
      at HttpKernel ->handle (object(Request), '1', true) 
      in /var/www/ezp/500-ezp/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php at line 193    
      at Kernel ->handle (object(Request), '1', true) 
      in /var/www/ezp/500-ezp/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php at line 447    
      at HttpCache ->forward (object(Request), true, null) 
      in /var/www/ezp/500-ezp/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php at line 60    
      at HttpCache ->forward (object(Request), true) 
      in /var/www/ezp/500-ezp/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php at line 416    
      at HttpCache ->fetch (object(Request), true) 
      in /var/www/ezp/500-ezp/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php at line 316    
      at HttpCache ->lookup (object(Request), true) 
      in /var/www/ezp/500-ezp/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php at line 193    
      at HttpCache ->handle (object(Request)) 
      in /var/www/ezp/500-ezp/web/index.php at line 28    
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            Filipe.Dobreira-obsolete@ez.no Filipe Dobreira (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

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