MT - fix testCOCIandSearch (fallout from CHK-9517)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@16688 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2009-10-05 12:55:06 +00:00
parent 5ffcd36aa7
commit a63369dbb7
3 changed files with 47 additions and 12 deletions

View File

@@ -416,6 +416,20 @@ public class AuthenticationUtil implements InitializingBean
{
throw new IllegalStateException("AuthenticationUtil not yet initialised; default admin username not available");
}
if (isMtEnabled())
{
String runAsUser = AuthenticationUtil.getRunAsUser();
if (runAsUser != null)
{
String[] parts = splitUserTenant(runAsUser);
if (parts.length == 2)
{
return defaultAdminUserName + TenantService.SEPARATOR + parts[1];
}
}
}
return defaultAdminUserName;
}
@@ -576,13 +590,13 @@ public class AuthenticationUtil implements InitializingBean
public static void logNDC(String userName)
{
NDC.remove();
if (isMtEnabled())
{
int idx = userName.indexOf(TenantService.SEPARATOR);
if ((idx != -1) && (idx < (userName.length() - 1)))
String[] parts = splitUserTenant(userName);
if (parts.length == 2)
{
NDC.push("Tenant:" + userName.substring(idx + 1) + " User:" + userName.substring(0, idx));
NDC.push("Tenant:" + parts[1] + " User:" + parts[0]);
}
else
{
@@ -594,5 +608,9 @@ public class AuthenticationUtil implements InitializingBean
NDC.push("User:" + userName);
}
}
private static String[] splitUserTenant(String userName)
{
return userName.split(TenantService.SEPARATOR);
}
}