Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)

68159: Merged V4.2-BUG-FIX (4.2.3) to HEAD-BUG-FIX (4.3/Cloud)
      67866: MNT-11072 : Auditing not logging when system is on read only mode
      Fixed audit to be recorded on a read-only system.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@68441 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mark Rogers
2014-04-30 16:20:50 +00:00
parent eb0220cb38
commit b9cce28a70
3 changed files with 29 additions and 15 deletions

View File

@@ -75,8 +75,6 @@ public interface AuditComponent
* this method might return <tt>false</tt> are: auditing is disabled; no audit applications
* have been registered. Sometimes, depending on the log level, this method may always
* return <tt>true</tt>.
* <p/>
* <tt>false</tt> will always be returned if the server is read-only.
*
*
* @return Returns <code>true</code> if the calling code (data producers)

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2012 Alfresco Software Limited.
* Copyright (C) 2005-2014 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -42,6 +42,7 @@ import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
import org.alfresco.repo.transaction.AlfrescoTransactionSupport.TxnReadState;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.service.cmr.audit.AuditQueryParameters;
import org.alfresco.service.cmr.audit.AuditService.AuditQueryCallback;
@@ -247,16 +248,8 @@ public class AuditComponentImpl implements AuditComponent
*/
public boolean areAuditValuesRequired()
{
if (transactionService.isReadOnly())
{
return false;
}
else
{
return
(loggerInbound.isDebugEnabled()) ||
return (loggerInbound.isDebugEnabled()) ||
(isAuditEnabled() && !auditModelRegistry.getAuditPathMapper().isEmpty());
}
}
/**
@@ -580,7 +573,9 @@ public class AuditComponentImpl implements AuditComponent
return recordAuditValuesImpl(mappedValues);
}
};
return transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true);
RetryingTransactionHelper txnHelper = transactionService.getRetryingTransactionHelper();
txnHelper.setForceWritable(true);
return txnHelper.doInTransaction(callback, false, true);
case TXN_READ_WRITE:
return recordAuditValuesImpl(mappedValues);
default: