Merged V3.1 to HEAD

13037: PostgreSQL upgrade scripts from 2.1.6, 2.2.0, and 2.2.1
   12995: Fix build: account for change of path to log4j jar in 3rd party project
   12981: Added support for monitoring of installed modules via JMX
   12971: Correction to 12970 - better handle case when log4j not available.
   12970: Work around log4j bug to allow editing of the "threshold" property of HierarchyDynamicBean through JMX
   12926: Merged V3.0 to V3.1
      Merged V2.2 to V3.0
         12861: ETHREEOH-19, ETHREEOH-24, ETHREEOH-113, ETHREEOH-115, ETHREEOH-449, ETHREEOH-537, ETHREEOH-561, ETHREEOH-566, ETHREEOH-572, ETHREEOH-1072: Retry failed transactions from MS SQL Server in snapshot mode 
   12924: Avoid direct log4j dependencies
   12918: Avoided Log4J imports by using introspection


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13516 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2009-03-10 13:17:24 +00:00
parent 352e065b07
commit b60eb95e1b
4 changed files with 34 additions and 28 deletions

View File

@@ -38,10 +38,13 @@ import net.sf.acegisecurity.providers.dao.User;
import org.alfresco.repo.tenant.TenantService;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.util.EqualsHelper;
import org.alfresco.util.log.NDC;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.log4j.NDC;
/**
* Utility helper methods to change the authenticated context for threads.
*/
public abstract class AuthenticationUtil
{
static Log s_logger = LogFactory.getLog(AuthenticationUtil.class);
@@ -59,7 +62,7 @@ public abstract class AuthenticationUtil
public static final String SYSTEM_USER_NAME = "System";
private static boolean mtEnabled = false;
public static void setMtEnabled(boolean mtEnabled)
{
if (!AuthenticationUtil.mtEnabled)
@@ -523,23 +526,23 @@ public abstract class AuthenticationUtil
public static void logNDC(String userName)
{
NDC.remove();
if (isMtEnabled())
NDC.remove();
if (isMtEnabled())
{
int idx = userName.indexOf(TenantService.SEPARATOR);
if ((idx != -1) && (idx < (userName.length() - 1)))
int idx = userName.indexOf(TenantService.SEPARATOR);
if ((idx != -1) && (idx < (userName.length() - 1)))
{
NDC.push("Tenant:" + userName.substring(idx + 1) + " User:" + userName.substring(0, idx));
NDC.push("Tenant:" + userName.substring(idx + 1) + " User:" + userName.substring(0, idx));
}
else
{
NDC.push("User:" + userName);
NDC.push("User:" + userName);
}
}
else
else
{
NDC.push("User:" + userName);
NDC.push("User:" + userName);
}
}
}