Details
-
Bug
-
Resolution: Fixed
-
High
-
None
-
None
-
eZP: 4.7
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.