mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged BRANCHES/DEV/THOR1 to HEAD:
30966: MT: rationalise getDomain(...) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@30993 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -538,26 +538,7 @@ public class MultiTServiceImpl implements TenantService
|
||||
*/
|
||||
public boolean isTenantName(String name)
|
||||
{
|
||||
return getMultiTenantDomainName(name) != null;
|
||||
}
|
||||
|
||||
public static String getMultiTenantDomainName(String name)
|
||||
{
|
||||
// Check that all the passed values are not null
|
||||
ParameterCheck.mandatory("name", name);
|
||||
|
||||
int idx1 = name.indexOf(SEPARATOR);
|
||||
if (idx1 == 0)
|
||||
{
|
||||
int idx2 = name.indexOf(SEPARATOR, 1);
|
||||
if (idx2 != -1)
|
||||
{
|
||||
return name.substring(1, idx2);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return false == getDomain(name, false).isEmpty();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -595,11 +576,12 @@ public class MultiTServiceImpl implements TenantService
|
||||
*/
|
||||
public String getDomain(String name)
|
||||
{
|
||||
// Check that all the passed values are not null
|
||||
ParameterCheck.mandatory("name", name);
|
||||
return getDomain(name, false);
|
||||
}
|
||||
|
||||
name = getTenantDomain(name);
|
||||
String tenantDomain = getCurrentUserDomain();
|
||||
public String getDomain(String name, boolean checkCurrentDomain)
|
||||
{
|
||||
ParameterCheck.mandatory("name", name);
|
||||
|
||||
String nameDomain = DEFAULT_DOMAIN;
|
||||
|
||||
@@ -607,13 +589,18 @@ public class MultiTServiceImpl implements TenantService
|
||||
if (idx1 == 0)
|
||||
{
|
||||
int idx2 = name.indexOf(SEPARATOR, 1);
|
||||
nameDomain = name.substring(1, idx2);
|
||||
nameDomain = getTenantDomain(name.substring(1, idx2));
|
||||
|
||||
if (checkCurrentDomain)
|
||||
{
|
||||
String tenantDomain = getCurrentUserDomain();
|
||||
|
||||
if ((! tenantDomain.equals(DEFAULT_DOMAIN)) && (! tenantDomain.equals(nameDomain)))
|
||||
{
|
||||
throw new AlfrescoRuntimeException("domain mismatch: expected = " + tenantDomain + ", actual = " + nameDomain);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nameDomain;
|
||||
}
|
||||
@@ -717,10 +704,8 @@ public class MultiTServiceImpl implements TenantService
|
||||
tenantsCache.remove(tenantDomain);
|
||||
}
|
||||
|
||||
protected String getTenantDomain(String tenantDomain)
|
||||
private String getTenantDomain(String tenantDomain)
|
||||
{
|
||||
ParameterCheck.mandatory("tenantDomain", tenantDomain);
|
||||
return tenantDomain.toLowerCase(I18NUtil.getLocale());
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -34,8 +34,8 @@ import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||
import org.alfresco.repo.tenant.Tenant;
|
||||
import org.alfresco.repo.tenant.TenantAdminService;
|
||||
import org.alfresco.repo.tenant.TenantService;
|
||||
import org.alfresco.repo.transaction.TransactionServiceImpl;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.repo.transaction.TransactionServiceImpl;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
@@ -526,7 +526,7 @@ public class UserUsageTrackingComponent extends AbstractLifecycleBean
|
||||
{
|
||||
return collapseUsage(usageNodeRef);
|
||||
}
|
||||
}, tenantAdminService.getDomainUser(AuthenticationUtil.getSystemUserName(), tenantAdminService.getDomain(usageNodeRef.getStoreRef().getIdentifier())));
|
||||
}, tenantAdminService.getDomainUser(AuthenticationUtil.getSystemUserName(), tenantService.getDomain(usageNodeRef.getStoreRef().getIdentifier())));
|
||||
|
||||
if (collapsed)
|
||||
{
|
||||
|
@@ -27,7 +27,6 @@ import java.util.Map;
|
||||
|
||||
import org.alfresco.repo.i18n.MessageService;
|
||||
import org.alfresco.repo.jscript.ScriptNode;
|
||||
import org.alfresco.repo.tenant.MultiTServiceImpl;
|
||||
import org.alfresco.repo.tenant.TenantService;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.dictionary.TypeDefinition;
|
||||
@@ -342,7 +341,7 @@ public class WorkflowObjectFactory
|
||||
public Boolean apply(T value)
|
||||
{
|
||||
String key = processKeyGetter.apply(value);
|
||||
String domain = MultiTServiceImpl.getMultiTenantDomainName(key);
|
||||
String domain = tenantService.getDomain(key, false);
|
||||
if(enabled)
|
||||
{
|
||||
if(currentDomain.equals(domain))
|
||||
|
Reference in New Issue
Block a user