cancel
Showing results for 
Search instead for 
Did you mean: 

CMIS with multi tenancy

andrewg5e
Champ in-the-making
Champ in-the-making
We're using CMIS (via OpenCMIS) to access an Alfresco Community 4.0b repository with multi-tenancy enabled. When we were using the "old" 3.x CMIS AtomPub endpoint, users in different tenants got the tenant-specific folders and documents in object fetches. When using the new 4.x endpoint, all tenants get objects back from the "non-tenant" spaces.

For example, getObjectByPath("/Foo/Bar") using "someone@tenant" would return the ID of the tenant-specific folder.

When switching to the new binding, "/Foo/Bar" returns the ID of the folder in the "non-tenant" area of the repository (not sure what to call that).

I searched through JIRA but didn't see any bugs related to CMIS and multi-tenancy. Has anyone else seen this behavior?
4 REPLIES 4

gressho
Champ in-the-making
Champ in-the-making
Yes, I've seen this behaviour! We will try with the 4.0 Enterprise version and 4.0d :cry:

gressho
Champ in-the-making
Champ in-the-making
Just tested with the enterprise release: the repository ids are identical in all tenants, the id's of the folders and documents inside differ!
So I'll give the 4.0d community edition a try (was released the same day).

andrewg5e
Champ in-the-making
Champ in-the-making
Thanks, I'll also upgrade to 4.0d as well and see if that has a fix.

andrewg5e
Champ in-the-making
Champ in-the-making
I have an update to this. We continued issues with Alfresco 4.0.d Community and the 4.x Atom endpoint. I debugged the problem and it turned out to be an issue with how the CMISConnector manages its map of CMISRenditionMapping objects. In a multi-tenancy environment, the map does not seem to get pre-populated consistently. So the following code can cause a NullPointerException:


    public List<RenditionData> getRenditions(NodeRef nodeRef, String renditionFilter, BigInteger maxItems,
            BigInteger skipCount)
    {
        String tenantDomain = tenantAdminService.getCurrentUserDomain();
        CMISRenditionMapping mapping = renditionMapping.get(tenantDomain);    //BUG: "mapping" might be null

        return mapping.getRenditions(nodeRef, renditionFilter, maxItems, skipCount);
    }

My fix was to test for "null" and add a map entry if needed:


    public List<RenditionData> getRenditions(NodeRef nodeRef, String renditionFilter, BigInteger maxItems,
            BigInteger skipCount)
    {
        String tenantDomain = tenantAdminService.getCurrentUserDomain();
        CMISRenditionMapping mapping = getRenditionMapping(tenantDomain);

        return mapping.getRenditions(nodeRef, renditionFilter, maxItems, skipCount);
    }

   private CMISRenditionMapping getRenditionMapping(String tenantDomain)
   {
      CMISRenditionMapping mapping = renditionMapping.get(tenantDomain);
      if (mapping == null)
      {
         mapping = new CMISRenditionMapping(nodeService, contentService, renditionService,
               transactionService, kindToRenditionNames);

      }
      return mapping;
   }


Hope this helps anyone who's using Alfresco 4.0 Community with CMIS and multi-tenancy enabled.