cancel
Showing results for 
Search instead for 
Did you mean: 

How do I check if nodes are valid for specific user?

insiders
Champ in-the-making
Champ in-the-making
I keep references to documents outside Alfresco.
Now I want to check if a specific user has access to these references. Unfortuneately I get an AxisFault if one of the references is invalid.

Here is some sample code:

      // create references
      Store _store = new Store(Constants.WORKSPACE_STORE, "SpacesStore");
      String docPath1 = "/app:company_home/app:projects/cm:connectortest/cm:accessCheck/cm:all/cm:for_x0020_everybody1.txt";
      String docPath2 = "/app:company_home/app:projects/cm:connectortest/cm:accessCheck/cm:user1_x0020_only/cm:top_x0020_secret1.txt";
      String docPath3 = "/app:company_home/app:projects/cm:connectortest/cm:accessCheck/cm:all/cm:for_x0020_everybody2.txt";
      Reference reference1 = new Reference(_store, null,docPath1);
      Reference reference2 = new Reference(_store, null,docPath2);
      Reference reference3 = new Reference(_store, null,docPath3);
      Reference[] references = new Reference[]{reference1, reference2, reference3};
      // check references
      // -> calling this results in AxisFault, since reference 2 is
      //   not accessible for this user
      Node[] nodes = WebServiceFactory.getRepositoryService().get(
            new Predicate(references, _store, null));


I could check document by document, but that would result in very bad performance, especially when I have to check thousands of references.
Has anyone an idea or a tip how to solve this problem?
1 REPLY 1

tim-erwin
Champ in-the-making
Champ in-the-making
Hi Insiders,

I first try to get all the references at once which is fast in the normal and usual case. In case of errors I catch them and THEN one by one.

Regards,
Tim