mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-3293 RM Audit History does not log Cutoff
This commit is contained in:
@@ -17,6 +17,8 @@ imap.server.attachments.extraction.enabled=false
|
|||||||
#
|
#
|
||||||
audit.enabled=true
|
audit.enabled=true
|
||||||
audit.rm.enabled=true
|
audit.rm.enabled=true
|
||||||
|
audit.rm.runasadmin=false
|
||||||
|
#audit.filter.alfresco-access.transaction.user=~null;.*
|
||||||
|
|
||||||
#
|
#
|
||||||
# Extended permission service cache sizing
|
# Extended permission service cache sizing
|
||||||
|
@@ -59,6 +59,7 @@
|
|||||||
<property name="jobDataAsMap">
|
<property name="jobDataAsMap">
|
||||||
<map>
|
<map>
|
||||||
<entry key="jobName" value="dispositionLifecycle"/>
|
<entry key="jobName" value="dispositionLifecycle"/>
|
||||||
|
<entry key="runAsAdmin" value="${audit.rm.runasadmin}"/>
|
||||||
<entry key="jobLockService">
|
<entry key="jobLockService">
|
||||||
<ref bean="jobLockService" />
|
<ref bean="jobLockService" />
|
||||||
</entry>
|
</entry>
|
||||||
|
@@ -42,12 +42,12 @@ import org.apache.commons.logging.LogFactory;
|
|||||||
import org.quartz.Job;
|
import org.quartz.Job;
|
||||||
import org.quartz.JobExecutionContext;
|
import org.quartz.JobExecutionContext;
|
||||||
import org.quartz.JobExecutionException;
|
import org.quartz.JobExecutionException;
|
||||||
|
import org.springframework.scheduling.quartz.QuartzJobBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base records management job implementation.
|
* Base records management job implementation.
|
||||||
* <p>
|
* <p>
|
||||||
* Delegates job execution and ensures locking
|
* Delegates job execution and ensures locking is enforced.
|
||||||
* is enforced.
|
|
||||||
*
|
*
|
||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
*/
|
*/
|
||||||
@@ -55,6 +55,9 @@ public class RecordsManagementJob implements Job
|
|||||||
{
|
{
|
||||||
private static Log logger = LogFactory.getLog(RecordsManagementJob.class);
|
private static Log logger = LogFactory.getLog(RecordsManagementJob.class);
|
||||||
|
|
||||||
|
/** indicates whether the audit history should be run as admin or not */
|
||||||
|
private boolean runAsAdmin = false;
|
||||||
|
|
||||||
private static final long DEFAULT_TIME = 30000L;
|
private static final long DEFAULT_TIME = 30000L;
|
||||||
|
|
||||||
private JobLockService jobLockService;
|
private JobLockService jobLockService;
|
||||||
@@ -85,7 +88,6 @@ public class RecordsManagementJob implements Job
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempts to get the lock. If the lock couldn't be taken, then <tt>null</tt> is returned.
|
* Attempts to get the lock. If the lock couldn't be taken, then <tt>null</tt> is returned.
|
||||||
*
|
*
|
||||||
@@ -107,27 +109,21 @@ public class RecordsManagementJob implements Job
|
|||||||
public void execute(JobExecutionContext context) throws JobExecutionException
|
public void execute(JobExecutionContext context) throws JobExecutionException
|
||||||
{
|
{
|
||||||
// get the job lock service
|
// get the job lock service
|
||||||
jobLockService = (JobLockService)context.getJobDetail().getJobDataMap().get("jobLockService");
|
jobLockService = (JobLockService) context.getJobDetail().getJobDataMap().get("jobLockService");
|
||||||
if (jobLockService == null)
|
if (jobLockService == null) { throw new AlfrescoRuntimeException("Job lock service has not been specified."); }
|
||||||
{
|
|
||||||
throw new AlfrescoRuntimeException("Job lock service has not been specified.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// get the job executer
|
// get the job executer
|
||||||
jobExecuter = (RecordsManagementJobExecuter)context.getJobDetail().getJobDataMap().get("jobExecuter");
|
jobExecuter = (RecordsManagementJobExecuter) context.getJobDetail().getJobDataMap().get("jobExecuter");
|
||||||
if (jobExecuter == null)
|
if (jobExecuter == null) { throw new AlfrescoRuntimeException("Job executer has not been specified."); }
|
||||||
{
|
|
||||||
throw new AlfrescoRuntimeException("Job executer has not been specified.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// get the job name
|
// get the job name
|
||||||
jobName = (String)context.getJobDetail().getJobDataMap().get("jobName");
|
jobName = (String) context.getJobDetail().getJobDataMap().get("jobName");
|
||||||
if (jobName == null)
|
if (jobName == null) { throw new AlfrescoRuntimeException("Job name has not been specified."); }
|
||||||
{
|
|
||||||
throw new AlfrescoRuntimeException("Job name has not been specified.");
|
setRunAsAdmin(Boolean.parseBoolean((String) context.getJobDetail().getJobDataMap().get("runAsAdmin")));
|
||||||
}
|
|
||||||
|
|
||||||
final LockCallback lockCallback = new LockCallback();
|
final LockCallback lockCallback = new LockCallback();
|
||||||
|
|
||||||
AuthenticationUtil.runAs(new RunAsWork<Void>()
|
AuthenticationUtil.runAs(new RunAsWork<Void>()
|
||||||
{
|
{
|
||||||
public Void doWork()
|
public Void doWork()
|
||||||
@@ -154,7 +150,8 @@ public class RecordsManagementJob implements Job
|
|||||||
// Ignore
|
// Ignore
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
logger.debug("Lock release failed: " + getLockQName() + ": " + lockToken + "(" + e.getMessage() + ")");
|
logger.debug("Lock release failed: " + getLockQName() + ": " + lockToken + "("
|
||||||
|
+ e.getMessage() + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -163,6 +160,17 @@ public class RecordsManagementJob implements Job
|
|||||||
// return
|
// return
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}, AuthenticationUtil.getSystemUserName());
|
}, this.runAsAdmin ? AuthenticationUtil.getAdminUserName() : AuthenticationUtil.getSystemUserName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isRunAsAdmin()
|
||||||
|
{
|
||||||
|
return runAsAdmin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRunAsAdmin(boolean runAsAdmin)
|
||||||
|
{
|
||||||
|
this.runAsAdmin = runAsAdmin;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user