mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-5987 View Audit Log can crash Alfresco
This commit is contained in:
@@ -17,6 +17,7 @@ imap.server.attachments.extraction.enabled=false
|
|||||||
#
|
#
|
||||||
audit.enabled=true
|
audit.enabled=true
|
||||||
audit.rm.enabled=true
|
audit.rm.enabled=true
|
||||||
|
audit.rm.viewLog.maxSize=100
|
||||||
#audit.rm.runas=admin
|
#audit.rm.runas=admin
|
||||||
|
|
||||||
#audit.filter.alfresco-access.transaction.user=~null;.*
|
#audit.filter.alfresco-access.transaction.user=~null;.*
|
||||||
|
@@ -537,6 +537,9 @@
|
|||||||
<property name="namespaceService" ref="namespaceService" />
|
<property name="namespaceService" ref="namespaceService" />
|
||||||
<property name="capabilityService" ref="CapabilityService" />
|
<property name="capabilityService" ref="CapabilityService" />
|
||||||
<property name="filePlanService" ref="FilePlanService" />
|
<property name="filePlanService" ref="FilePlanService" />
|
||||||
|
<property name="viewLogMaxSize">
|
||||||
|
<value>${audit.rm.viewLog.maxSize}</value>
|
||||||
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- REST impl for GET Class Definitions for RM/DM -->
|
<!-- REST impl for GET Class Definitions for RM/DM -->
|
||||||
|
@@ -57,6 +57,7 @@ public class AuditLogGet extends BaseAuditRetrievalWebScript
|
|||||||
|
|
||||||
private static final String PARAM_EXPORT = "export";
|
private static final String PARAM_EXPORT = "export";
|
||||||
private static final String ACCESS_AUDIT_CAPABILITY = "AccessAudit";
|
private static final String ACCESS_AUDIT_CAPABILITY = "AccessAudit";
|
||||||
|
private static final int DEFAULT_VIEW_LOG_MAX_SIZE = 100;
|
||||||
|
|
||||||
/** Content Streamer */
|
/** Content Streamer */
|
||||||
protected ContentStreamer contentStreamer;
|
protected ContentStreamer contentStreamer;
|
||||||
@@ -66,6 +67,9 @@ public class AuditLogGet extends BaseAuditRetrievalWebScript
|
|||||||
|
|
||||||
/** File plan service */
|
/** File plan service */
|
||||||
protected FilePlanService filePlanService;
|
protected FilePlanService filePlanService;
|
||||||
|
|
||||||
|
/** Maximum number of entries to be displayed in View Audit Log */
|
||||||
|
private int viewLogMaxSize;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param contentStreamer
|
* @param contentStreamer
|
||||||
@@ -86,13 +90,22 @@ public class AuditLogGet extends BaseAuditRetrievalWebScript
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param capabilityService Capability Service
|
* @param filePlanService File Plan Service
|
||||||
*/
|
*/
|
||||||
public void setFilePlanService(FilePlanService filePlanService)
|
public void setFilePlanService(FilePlanService filePlanService)
|
||||||
{
|
{
|
||||||
this.filePlanService = filePlanService;
|
this.filePlanService = filePlanService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param viewLogMaxSize Maximum number of entries to be displayed in View Audit Log
|
||||||
|
*/
|
||||||
|
public void setViewLogMaxSize(int viewLogMaxSize)
|
||||||
|
{
|
||||||
|
this.viewLogMaxSize = (viewLogMaxSize <= 0 ? DEFAULT_VIEW_LOG_MAX_SIZE: viewLogMaxSize);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException
|
public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException
|
||||||
{
|
{
|
||||||
@@ -100,7 +113,6 @@ public class AuditLogGet extends BaseAuditRetrievalWebScript
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
RecordsManagementAuditQueryParameters queryParams = parseQueryParameters(req);
|
RecordsManagementAuditQueryParameters queryParams = parseQueryParameters(req);
|
||||||
ReportFormat reportFormat = parseReportFormat(req);
|
ReportFormat reportFormat = parseReportFormat(req);
|
||||||
|
|
||||||
@@ -108,6 +120,13 @@ public class AuditLogGet extends BaseAuditRetrievalWebScript
|
|||||||
{
|
{
|
||||||
throw new WebScriptException(Status.STATUS_FORBIDDEN, "Access denied because the user does not have the Access Audit capability");
|
throw new WebScriptException(Status.STATUS_FORBIDDEN, "Access denied because the user does not have the Access Audit capability");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// limit the number of audit log entries to be returned
|
||||||
|
if (queryParams.getMaxEntries() == 0 || queryParams.getMaxEntries() > viewLogMaxSize)
|
||||||
|
{
|
||||||
|
queryParams.setMaxEntries(viewLogMaxSize);
|
||||||
|
}
|
||||||
|
|
||||||
// parse the parameters and get a file containing the audit trail
|
// parse the parameters and get a file containing the audit trail
|
||||||
auditTrail = this.rmAuditService.getAuditTrailFile(queryParams, reportFormat);
|
auditTrail = this.rmAuditService.getAuditTrailFile(queryParams, reportFormat);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user