AnsweredAssumed Answered

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

Question asked by insiders on Mar 27, 2008
Latest reply on Jun 24, 2008 by tim-erwin
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?