mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Tenant Service hooks for LockService, FileFolderService and other MT fixes (DbNodeService & AuthorityService)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6437 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -41,6 +41,7 @@ import org.alfresco.repo.policy.JavaBehaviour;
|
||||
import org.alfresco.repo.policy.PolicyComponent;
|
||||
import org.alfresco.repo.policy.PolicyScope;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.tenant.TenantService;
|
||||
import org.alfresco.repo.version.VersionServicePolicies;
|
||||
import org.alfresco.service.cmr.lock.LockService;
|
||||
import org.alfresco.service.cmr.lock.LockStatus;
|
||||
@@ -77,6 +78,11 @@ public class LockServiceImpl implements LockService,
|
||||
* The node service
|
||||
*/
|
||||
private NodeService nodeService;
|
||||
|
||||
/**
|
||||
* The tenant service
|
||||
*/
|
||||
private TenantService tenantService;
|
||||
|
||||
/**
|
||||
* The policy component
|
||||
@@ -114,6 +120,17 @@ public class LockServiceImpl implements LockService,
|
||||
{
|
||||
this.nodeService = nodeService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the tenant service
|
||||
*
|
||||
* @param tenantService
|
||||
* the tenant service
|
||||
*/
|
||||
public void setTenantService(TenantService tenantService)
|
||||
{
|
||||
this.tenantService = tenantService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the policy component
|
||||
@@ -208,6 +225,8 @@ public class LockServiceImpl implements LockService,
|
||||
*/
|
||||
public synchronized void lock(NodeRef nodeRef, LockType lockType, int timeToExpire)
|
||||
{
|
||||
nodeRef = tenantService.getName(nodeRef);
|
||||
|
||||
// Check for lock aspect
|
||||
checkForLockApsect(nodeRef);
|
||||
|
||||
@@ -303,6 +322,8 @@ public class LockServiceImpl implements LockService,
|
||||
*/
|
||||
public synchronized void unlock(NodeRef nodeRef) throws UnableToReleaseLockException
|
||||
{
|
||||
nodeRef = tenantService.getName(nodeRef);
|
||||
|
||||
// Check for lock aspect
|
||||
checkForLockApsect(nodeRef);
|
||||
|
||||
@@ -357,6 +378,8 @@ public class LockServiceImpl implements LockService,
|
||||
*/
|
||||
public LockStatus getLockStatus(NodeRef nodeRef)
|
||||
{
|
||||
nodeRef = tenantService.getName(nodeRef);
|
||||
|
||||
return getLockStatus(nodeRef, getUserName());
|
||||
}
|
||||
|
||||
@@ -445,6 +468,8 @@ public class LockServiceImpl implements LockService,
|
||||
public void checkForLock(NodeRef nodeRef) throws NodeLockedException
|
||||
{
|
||||
String userName = getUserName();
|
||||
|
||||
nodeRef = tenantService.getName(nodeRef);
|
||||
|
||||
// Ensure we have found a node reference
|
||||
if (nodeRef != null && userName != null)
|
||||
|
@@ -35,6 +35,7 @@ import java.util.Map;
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.search.QueryParameterDefImpl;
|
||||
import org.alfresco.repo.tenant.TenantService;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.model.FileExistsException;
|
||||
@@ -118,6 +119,7 @@ public class FileFolderServiceImpl implements FileFolderService
|
||||
private NamespaceService namespaceService;
|
||||
private DictionaryService dictionaryService;
|
||||
private NodeService nodeService;
|
||||
private TenantService tenantService;
|
||||
private CopyService copyService;
|
||||
private SearchService searchService;
|
||||
private ContentService contentService;
|
||||
@@ -148,7 +150,12 @@ public class FileFolderServiceImpl implements FileFolderService
|
||||
{
|
||||
this.nodeService = nodeService;
|
||||
}
|
||||
|
||||
|
||||
public void setTenantService(TenantService tenantService)
|
||||
{
|
||||
this.tenantService = tenantService;
|
||||
}
|
||||
|
||||
public void setCopyService(CopyService copyService)
|
||||
{
|
||||
this.copyService = copyService;
|
||||
@@ -469,6 +476,8 @@ public class FileFolderServiceImpl implements FileFolderService
|
||||
|
||||
private List<NodeRef> luceneSearch(NodeRef contextNodeRef, boolean folders, boolean files)
|
||||
{
|
||||
contextNodeRef = tenantService.getName(contextNodeRef);
|
||||
|
||||
SearchParameters params = new SearchParameters();
|
||||
params.setLanguage(SearchService.LANGUAGE_LUCENE);
|
||||
params.addStore(contextNodeRef.getStoreRef());
|
||||
|
@@ -1335,7 +1335,12 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
||||
}
|
||||
else
|
||||
{
|
||||
assocRef = assoc.getChildAssocRef();
|
||||
assocRef = new ChildAssociationRef(assoc.getChildAssocRef().getTypeQName(),
|
||||
tenantService.getBaseName(assoc.getChildAssocRef().getParentRef()),
|
||||
assoc.getChildAssocRef().getQName(),
|
||||
tenantService.getBaseName(assoc.getChildAssocRef().getChildRef()),
|
||||
assoc.getChildAssocRef().isPrimary(),
|
||||
assoc.getChildAssocRef().getNthSibling());
|
||||
}
|
||||
return assocRef;
|
||||
}
|
||||
|
@@ -104,7 +104,9 @@ public class AuthorityServiceImpl implements AuthorityService
|
||||
public boolean hasAdminAuthority()
|
||||
{
|
||||
String currentUserName = authenticationComponent.getCurrentUserName();
|
||||
return ((currentUserName != null) && adminUsers.contains(currentUserName));
|
||||
|
||||
// for MT, see note for getAuthoritiesForUser
|
||||
return ((currentUserName != null) && (adminUsers.contains(currentUserName) || adminUsers.contains(tenantService.getBaseNameUser(currentUserName))));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -117,7 +119,8 @@ public class AuthorityServiceImpl implements AuthorityService
|
||||
{
|
||||
canonicalName = authorityName;
|
||||
}
|
||||
return adminUsers.contains(canonicalName);
|
||||
// for MT, see note for getAuthoritiesForUser
|
||||
return (adminUsers.contains(canonicalName) || adminUsers.contains(tenantService.getBaseNameUser(canonicalName)));
|
||||
}
|
||||
|
||||
// IOC
|
||||
|
Reference in New Issue
Block a user