Dealing with documents where getPathAsString() == null

We are making an application that is using Relation document extensively. Documents subclassing the relation object are created using createDocumentModel(relationTypeName). This means that they are attached to no particular path in the tree.

This technique doesn't cause any problem when the client is connecting as Administrator but when connecting as another user, it means the user has no access to those documents. I have investigated Nuxeo source and subprojects and I found the following solutions may be possible.

  1. Set the ACL of the Relation documents so that anybody and find (Browse) and read (Read) them. This technique alone doesn't seem to work of I have not found the right way to do it.
  2. Create a directory for Relation objects and put every relation object there. It should be possible to give anyone read and browse right on the directory. I believe the comment service is doing that.
  3. Use a service or adapter to access the relation documents and use UnrestrictedSessionRunner access the documents. The tagging service is doing that.

Approach 3 is the most heavyweight and error-prone but would certainly work. Approach 2 is preferable but I would rather stick with my path-less documents and get approach 1 to work. I'm not sure what it takes for documents to be findable by non-administrator using in an NXQL document. Reference to relevant document is appreciated.

0 votes

1 answers

945 views

ANSWER

Setting an ACL on the Relation document should work. Can you double-check? If it's really not working then it's a bug, could you please open a NXP ticket?
12/20/2011



Correct. I have retried solution 1 and now everything seems to be working. Here is an example of correct configuration.

<extension point="factoryBinding" target="org.nuxeo.ecm.platform.content.template.service.ContentTemplateService">
    <factoryBinding name="ConservationRelationFactory" factoryName="SimpleTemplateFactory"
        targetType="ConservationRelation">
        <acl>
            <ace granted="true" permission="Read" principal="members"/>
        </acl>
    </factoryBinding>
</extension>
0 votes