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

Fatal error when uploading file to object relations with certain permissions

    XMLWordPrintable

Details

    Description

      When an object relations' default location is not accessible to a user, and the user attempts to upload a file, the operation will fail with a fatal error:

      Fatal error: Call to a member function attribute() on a non-object in extension/ezjscore/classes/ezjscserverfunctionsajaxuploader.php on line 143
      

      Steps to reproduce:

      1. Create a class with an object relations attribute
      2. Create an Editor user
      3. Allow the user to create objects of the newly created class, and remove the user's access to the Media section
      4. Login as the user, and create an instance of the newly created class
      5. Select the "Upload files" option on the object relations datatype, and pick any image file to upload
      6. Proceed with the upload. Before completing the operation, just before the step to pick a location for the Image object, an error about a failure to process the JSON response from the server will be displayed.

      In extension/ezjscore/classes/ezjscserverfunctionsajaxuploader.php, the following code fetches the default location for the Browse operation:

      $defaultParentNode = eZContentObjectTreeNode::fetch( $start );
              $browseItems = self::getBrowseItems( $defaultParentNode->attribute( 'parent' ), $class );
      

      $defaultParentNode will be null since the user does not have access to that node.

      Attachments

        Activity

          People

            Unassigned Unassigned
            Filipe.Dobreira-obsolete@ez.no Filipe Dobreira (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 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 - 7 hours, 45 minutes
                7h 45m