Menu

#251 Document Creation Failes With Entity Ref Error If Project Is Inaccessible

Creating a document in a folder fails with a queer message if the context does not have access to the project - even if the context explicitly has access to the folder. This should either fail with a nice AccessDenied or it should be permitted (the project marshaled without access limitations). The project is accessed in order to see if inherited ACLs are enabled.

2014-07-15 17:12:21,934 10937 context duration of project::get was 0.033
2014-07-15 17:12:21,941 10937 document::new Unable to marshall projectId#19680 related to specified folderId#168065529
2014-07-15 17:12:21,941 10937 http Unable to understand None as an entity reference (objectId)
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/OpenGroupware-0.1.49rc87-py2.6.egg/coils/net/http_handler.py", line 209, in process_request
    )(self.request_name, )
  File "/usr/lib/python2.6/site-packages/OpenGroupware-0.1.49rc87-py2.6.egg/coils/protocol/attachfs/entityobject.py", line 413, in do_PUT
    self._put_file_mode(name, scratch_file, mimetype)
  File "/usr/lib/python2.6/site-packages/OpenGroupware-0.1.49rc87-py2.6.egg/coils/protocol/attachfs/entityobject.py", line 288, in _put_file_mode
    handle=scratch_file,
  File "/usr/lib/python2.6/site-packages/OpenGroupware-0.1.49rc87-py2.6.egg/coils/core/context.py", line 566, in run_command
    command.run()
  File "/usr/lib/python2.6/site-packages/OpenGroupware-0.1.49rc87-py2.6.egg/coils/logic/blob/create_document.py", line 112, in run
    self.inherit_acls()
  File "/usr/lib/python2.6/site-packages/OpenGroupware-0.1.49rc87-py2.6.egg/coils/logic/blob/command.py", line 198, in inherit_acls
    'inheritACLs', )
  File "/usr/lib/python2.6/site-packages/OpenGroupware-0.1.49rc87-py2.6.egg/coils/core/propertymanager.py", line 137, in get_property
    object_id = PropertyManager.Get_Object_Id(entity)
  File "/usr/lib/python2.6/site-packages/OpenGroupware-0.1.49rc87-py2.6.egg/coils/core/propertymanager.py", line 75, in Get_Object_Id
    format(value, )
CoilsException: Unable to understand None as an entity reference (objectId)
2014-07-15 17:12:21,984 10937 context Closing context ff6de42a865b454e9bbe1dbb2767caaf

Discussion

  • Adam Tauno Williams

    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,6 +1,6 @@
     Creating a document in a folder fails with a queer message if the context does not have access to the project - even if the context explicitly has access to the folder.  This should either fail with a nice AccessDenied or it should be permitted (the project marshaled without access limitations).  The project is accessed in order to see if inherited ACLs are enabled.
    
    -2014-07-15 17:12:21,934 10937 context duration of project::get was 0.033
    
    +    2014-07-15 17:12:21,934 10937 context duration of project::get was 0.033
         2014-07-15 17:12:21,941 10937 document::new Unable to marshall projectId#19680 related to specified folderId#168065529
         2014-07-15 17:12:21,941 10937 http Unable to understand None as an entity reference (objectId)
         Traceback (most recent call last):
    
     
  • Adam Tauno Williams

    This code in run() of CreateDocument produces the cannot-marshal-project method, but later on the inherit_acls call does not check if the project id has been initialized - and it should always be set irregardless, assuming the user was able to create the document which is the duty of check_permissions

    run

    if ((self._project is None) and (self._folder is not None)):
        '''
        If no project was specified but a folder was then we try
        to assume the project assignment of the folder (if the
        folder is so assigned)
        '''
        if (self._folder.project_id is not None):
            self._project = self._ctx.run_command(
                'project::get',
                id=self._folder.project_id,
                access_check=self.access_check, )
            if (self._project is None):
                self.log.error(
                    'Unable to marshall projectId#{0} related '
                    'to specified folderId#{1}'.
                    format(self._folder.project_id,
                           self._folder.object_id))
    

    inherit_acls

    # Determine if ACL inheritance is enabled on the Project
    if not self.acls_from_client_saved:
        prop = \
            self._ctx.property_manager.get_property(
                self.obj.project_id,
                '57c7fc84-3cea-417d-af54-b659eb87a046',
                'inheritACLs', )
        if prop:
            if prop.get_value() == 'YES':
                inherit_acls = True
    
     

Log in to post a comment.

MongoDB Logo MongoDB