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

    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.

        Activity

        Hide
        Damien Pobel (Inactive) added a comment -

        Filipe: I'm not able to reproduce this issue with the steps you provide even if I can see others conditions in which this might fail the same way.

        Could you please provide the following elements:

        • the image you use to reproduce the issue
        • with which package (eZ Demo, eZ Flow, ...) you installed eZ Publish 4.7
        • did you apply the services packs ?
        • which extensions were enabled while reproducing the issue
        • could copy paste the value and the placement of the following settings as seen in /settings/view of the siteaccess where you reproduce the issue
          • content.ini/[RelationAssignmentSettings]/ClassSpecificAssignment
          • content.ini/[RelationAssignmentSettings]/DefaultAssignment
          • all settings under content.ini/[NodeSettings]
          • all settings under upload.ini/[CreateSettings]
          • upload.ini/[UploadSettings]/AliasList

        Thanks

        Show
        Damien Pobel (Inactive) added a comment - Filipe: I'm not able to reproduce this issue with the steps you provide even if I can see others conditions in which this might fail the same way. Could you please provide the following elements: the image you use to reproduce the issue with which package (eZ Demo, eZ Flow, ...) you installed eZ Publish 4.7 did you apply the services packs ? which extensions were enabled while reproducing the issue could copy paste the value and the placement of the following settings as seen in /settings/view of the siteaccess where you reproduce the issue content.ini/ [RelationAssignmentSettings] /ClassSpecificAssignment content.ini/ [RelationAssignmentSettings] /DefaultAssignment all settings under content.ini/ [NodeSettings] all settings under upload.ini/ [CreateSettings] upload.ini/ [UploadSettings] /AliasList Thanks
        Hide
        Filipe Dobreira (Inactive) added a comment -
        • Any image, in my case I used a random PNG I had lying around (http://i.imgur.com/tBnbpig.png)
        • I used eZFlow. You can reproduce this (and it's probably easier) from the admin interface
        • Yes, this was done on an up-to-date installation
        • Active extensions:

          ezxmlexport
          ezwebin
          ezmbpaex
          ezautosave
          ezstarrating
          ezodf
          ezcomments
          ezgmaplocation
          ezsi
          ezscriptmonitor
          ezsurvey
          ezfind
          ezcontentstaging
          ezie
          ez_network
          ezprestapiprovider
          ezwt
          ezjscore
          ezoe
          ezflow
          ezstyleeditor
          ezmultiupload
          ezformtoken

        • Settings:

           
          content.ini/RelationAssignmentSettings/ClassSpecificAssignment
          content.ini/RelationAssignmentSettings/ClassSpecificAssignment
          ^ unchanged, values from settings/content.ini were used:
           
          [RelationAssignmentSettings]
          DefaultAssignment=root
          ClassSpecificAssignment[]
          ClassSpecificAssignment[]=user,user_group;users/guest_accounts
          ClassSpecificAssignment[]=image;media/images
          ClassSpecificAssignment[]=video;media/multimedia
          ClassSpecificAssignment[]=file;media/files
          ClassSpecificAssignment[]=quicktime;media/multimedia
          ClassSpecificAssignment[]=windows_media;media/multimedia
          ClassSpecificAssignment[]=real_video;media/multimedia
          ClassSpecificAssignment[]=flash;media/multimedia
           
          content.ini/NodeSettings
          ^ unchanged, values from settings/content.ini were used:
           
          [NodeSettings]
          RootNode=2
          UserRootNode=5
          MediaRootNode=43
          SetupRootNode=48
          DesignRootNode=58
           
          upload.ini/CreateSettings
          ^ unchanged, values from settings/upload.ini were used:
           
          [CreateSettings]
          MimeClassMap[]
          MimeClassMap[image]=image
          MimeClassMap[video/quicktime]=quicktime
          MimeClassMap[video/x-msvideo]=windows_media
          MimeClassMap[video/vnd.rn-realvideo]=real_video
          MimeClassMap[application/vnd.rn-realmedia]=real_video
          MimeClassMap[application/x-shockwave-flash]=flash
          MimeClassMap[video/mp4]=video
          MimeUploadHandlerMap[]
          DefaultClass=file
           
          upload.ini/UploadSettings/AliasList
          ^ unchanged, values from settings/upload.ini were used:
           
          [UploadSettings]
          DefaultReturnType=NodeID
          AliasList[]
           

        Let me know if you need anything else.

        Show
        Filipe Dobreira (Inactive) added a comment - Any image, in my case I used a random PNG I had lying around ( http://i.imgur.com/tBnbpig.png ) I used eZFlow. You can reproduce this (and it's probably easier) from the admin interface Yes, this was done on an up-to-date installation Active extensions: ezxmlexport ezwebin ezmbpaex ezautosave ezstarrating ezodf ezcomments ezgmaplocation ezsi ezscriptmonitor ezsurvey ezfind ezcontentstaging ezie ez_network ezprestapiprovider ezwt ezjscore ezoe ezflow ezstyleeditor ezmultiupload ezformtoken Settings:   content.ini/RelationAssignmentSettings/ClassSpecificAssignment content.ini/RelationAssignmentSettings/ClassSpecificAssignment ^ unchanged, values from settings/content.ini were used:   [RelationAssignmentSettings] DefaultAssignment=root ClassSpecificAssignment[] ClassSpecificAssignment[]=user,user_group;users/guest_accounts ClassSpecificAssignment[]=image;media/images ClassSpecificAssignment[]=video;media/multimedia ClassSpecificAssignment[]=file;media/files ClassSpecificAssignment[]=quicktime;media/multimedia ClassSpecificAssignment[]=windows_media;media/multimedia ClassSpecificAssignment[]=real_video;media/multimedia ClassSpecificAssignment[]=flash;media/multimedia   content.ini/NodeSettings ^ unchanged, values from settings/content.ini were used:   [NodeSettings] RootNode=2 UserRootNode=5 MediaRootNode=43 SetupRootNode=48 DesignRootNode=58   upload.ini/CreateSettings ^ unchanged, values from settings/upload.ini were used:   [CreateSettings] MimeClassMap[] MimeClassMap[image]=image MimeClassMap[video/quicktime]=quicktime MimeClassMap[video/x-msvideo]=windows_media MimeClassMap[video/vnd.rn-realvideo]=real_video MimeClassMap[application/vnd.rn-realmedia]=real_video MimeClassMap[application/x-shockwave-flash]=flash MimeClassMap[video/mp4]=video MimeUploadHandlerMap[] DefaultClass=file   upload.ini/UploadSettings/AliasList ^ unchanged, values from settings/upload.ini were used:   [UploadSettings] DefaultReturnType=NodeID AliasList[]   Let me know if you need anything else.
        Hide
        Damien Pobel (Inactive) added a comment - - edited

        Filipe: what you tell me is inconsistent and confusing.

        ezodf adds some settings in an override of upload.ini and ezflow adds some settings in an override of content.ini, so if they are enabled you should see those in /settings/view in the admin interface (setup tab and then ini settings in the left menu). I don't need a copy/paste of settings/content.ini nor settings/upload.ini ...

        I used eZFlow. You can reproduce this (and it's probably easier) from the admin interface

        the upload in relation feature is only available in the admin interface...

        Show
        Damien Pobel (Inactive) added a comment - - edited Filipe: what you tell me is inconsistent and confusing. ezodf adds some settings in an override of upload.ini and ezflow adds some settings in an override of content.ini, so if they are enabled you should see those in /settings/view in the admin interface (setup tab and then ini settings in the left menu). I don't need a copy/paste of settings/content.ini nor settings/upload.ini ... I used eZFlow. You can reproduce this (and it's probably easier) from the admin interface the upload in relation feature is only available in the admin interface...
        Hide
        Filipe Dobreira (Inactive) added a comment -

        Hi Damien,

        I misunderstood your initial request, here's the relevant values from settings/view:

         
        content.ini/RelationAssignmentSettings/DefaultAssignment:
        "root"
         
        content.ini/RelationAssignmentSettings/ClassSpecificAssignment:
         [0]
         [1] user,user_group; users/guest_accounts
         [2] image; media/images
         [3] video; media/multimedia
         [4] file; media/files
         [5] quicktime; media/multimedia
         [6] windows_media; media/multimedia
         [7] real_video; media/multimedia
         [8] flash; media/multimedia
         
        content.ini/NodeSettings/
         RootNode: 2
         UserRootNode: 5
         MediaRootNode: 43
         SetupRootNode: 48
         DesignRootNode: 58
         
        upload.ini/CreateSettings/
         MimeClassMap:
          [0]
          [image] image
          [video/quicktime] quicktime
          [video/x-msvideo] windows_media
          [video/vnd.rn-realvideo] real_video
          [application/vnd.rn-realmedia] real_video
          [application/x-shockwave-flash] flash
          [video/mp4] video
          [video/x-flv] flash_player
         
         MimeUploadHandlerMap:
          [0]
          [application/vnd.oasis.opendocument.text] ezopenofficeuploadhandler
          [application/msword] ezopenofficeuploadhandler
          [application/rtf] ezopenofficeuploadhandler
         
         DefaultClass: "file"
         
        upload.ini/UploadSettings/AliasList:
         [0]
         

        I used eZFlow. You can reproduce this (and it's probably easier) from the admin interface:
        I used the eZ Flow package on my installation, but performed these operations through the admin interface.

        Show
        Filipe Dobreira (Inactive) added a comment - Hi Damien, I misunderstood your initial request, here's the relevant values from settings/view :   content.ini/RelationAssignmentSettings/DefaultAssignment: "root"   content.ini/RelationAssignmentSettings/ClassSpecificAssignment: [0] [1] user,user_group; users/guest_accounts [2] image; media/images [3] video; media/multimedia [4] file; media/files [5] quicktime; media/multimedia [6] windows_media; media/multimedia [7] real_video; media/multimedia [8] flash; media/multimedia   content.ini/NodeSettings/ RootNode: 2 UserRootNode: 5 MediaRootNode: 43 SetupRootNode: 48 DesignRootNode: 58   upload.ini/CreateSettings/ MimeClassMap: [0] [image] image [video/quicktime] quicktime [video/x-msvideo] windows_media [video/vnd.rn-realvideo] real_video [application/vnd.rn-realmedia] real_video [application/x-shockwave-flash] flash [video/mp4] video [video/x-flv] flash_player MimeUploadHandlerMap: [0] [application/vnd.oasis.opendocument.text] ezopenofficeuploadhandler [application/msword] ezopenofficeuploadhandler [application/rtf] ezopenofficeuploadhandler DefaultClass: "file"   upload.ini/UploadSettings/AliasList: [0]   I used eZFlow. You can reproduce this (and it's probably easier) from the admin interface : I used the eZ Flow package on my installation, but performed these operations through the admin interface.
        Show
        Patrick Allaert (Inactive) added a comment - PR available at: https://github.com/ezsystems/ezpublish-legacy/pull/570
        Show
        André Rømcke added a comment - Fixed in https://github.com/ezsystems/ezpublish-legacy/commit/77c4a01b60797c5ba50b200cc752790332d9b689
        Hide
        Paulo Nunes (Inactive) added a comment -

        QA Approved

        Show
        Paulo Nunes (Inactive) added a comment - QA Approved

          People

          • Assignee:
            Unassigned
            Reporter:
            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