Merged DEV to HEAD (5.1)

110726: ACE-979: WebDav MT RepositoryAuthenticationDao.getUserFolderLocation() seems to be no tenant-safe
      - Implemented a JUnit test.
      - Fixed RepositoryAuthenticationDAO.getUserFolderLocation() to use cache keys with tenant domain and use the domain to find correct user store.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@111250 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alex Mukha
2015-09-02 07:17:48 +00:00
parent 87a1d5221d
commit bb47289edf
2 changed files with 43 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2013 Alfresco Software Limited.
* Copyright (C) 2005-2014 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -308,15 +308,14 @@ public class RepositoryAuthenticationDao implements MutableAuthenticationDao, In
private NodeRef getUserFolderLocation(String caseSensitiveUserName)
{
NodeRef userNodeRef = singletonCache.get(KEY_USERFOLDER_NODEREF);
NodeRef userNodeRef = singletonCache.get((tenantService.getUserDomain(caseSensitiveUserName) + KEY_USERFOLDER_NODEREF));
if (userNodeRef == null)
{
QName qnameAssocSystem = QName.createQName("sys", "system", namespacePrefixResolver);
QName qnameAssocUsers = QName.createQName("sys", "people", namespacePrefixResolver);
//StoreRef userStoreRef = tenantService.getName(caseSensitiveUserName, new StoreRef(STOREREF_USERS.getProtocol(), STOREREF_USERS.getIdentifier()));
StoreRef userStoreRef = new StoreRef(STOREREF_USERS.getProtocol(), STOREREF_USERS.getIdentifier());
StoreRef userStoreRef = tenantService.getName(caseSensitiveUserName, new StoreRef(STOREREF_USERS.getProtocol(), STOREREF_USERS.getIdentifier()));
// AR-527
NodeRef rootNode = nodeService.getRootNode(userStoreRef);
List<ChildAssociationRef> results = nodeService.getChildAssocs(rootNode, RegexQNamePattern.MATCH_ALL, qnameAssocSystem);
@@ -338,7 +337,7 @@ public class RepositoryAuthenticationDao implements MutableAuthenticationDao, In
{
userNodeRef = tenantService.getName(results.get(0).getChildRef());
}
singletonCache.put(KEY_USERFOLDER_NODEREF, userNodeRef);
singletonCache.put((tenantService.getUserDomain(caseSensitiveUserName) + KEY_USERFOLDER_NODEREF), userNodeRef);
}
return userNodeRef;
}