As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
public class Audit extends AbstractWebScript { private final Log logger = LogFactory.getLog(visorSignatures.class); private AuditComponent auditComponent; // for Spring injection public void setAuditComponent(AuditComponent auditComponent) { this.auditComponent = auditComponent; } public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException { Map<String, Serializable> auditMap = new HashMap<String, Serializable>(); String source = req.getParameter("source"); String userName = req.getParameter("userName"); String fullName = req.getParameter("fullName"); try { auditMap.put(AuditApplication.buildPath("/userName"), userName); auditMap.put(AuditApplication.buildPath("/source"), source); auditMap.put(AuditApplication.buildPath("/fullName"), fullName); auditComponent.recordAuditValues(source, auditMap); logger.debug("RM Audit: Auditing values: \n" + auditMap); } catch (Exception e) { throw new AlfrescoRuntimeException( "Error en la generació de registres d'auditoria", e); } } }
<?xml version='1.0' encoding='UTF-8'?> <!– Default Audit Configuration –> <Audit xmlns="http://www.alfresco.org/repo/audit/model/3.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.alfresco.org/repo/audit/model/3.2 alfresco-audit-3.2.xsd" > <DataExtractors> <DataExtractor name="simpleValue" registeredName="auditModel.extractor.simpleValue"/> <DataExtractor name="nullValue" registeredName="auditModel.extractor.nullValue"/> <DataExtractor name="nodeName" registeredName="auditModel.extractor.nodeName"/> <DataExtractor name="nodeType" registeredName="auditModel.extractor.nodeType"/> <DataExtractor name="userRoles" registeredName="org_alfresco_module_dod5015_userRolesExtractor"/> <DataExtractor name="namePath" registeredName="org_alfresco_module_dod5015_namePathExtractor"/> <DataExtractor name="nodeRefPath" registeredName="org_alfresco_module_dod5015_nodeRefPathExtractor"/> <DataExtractor name="nodeIdentifier" registeredName="org_alfresco_module_dod5015_identifierExtractor"/> </DataExtractors> <DataGenerators> <DataGenerator name="personFullName" registeredName="auditModel.generator.personFullName"/> </DataGenerators> <PathMappings> <PathMap source="/DOD5015" target="/DOD5015"/> <!– Force the fullName generator to trigger –> <PathMap source="/DOD5015/event/node" target="/DOD5015/event/person"/> <PathMap source="/alfresco-api/post/AuthenticationService/authenticate" target="/DOD5015/login"/> <PathMap source="/DOD5015/visorSignatures" target="/DOD5015/visorSignatures"/> <PathMap source="/DOD5015/consultaDocument" target="/DOD5015/consultaDocument"/> </PathMappings> <Application name="DOD5015" key="DOD5015"> <AuditPath key="event"> <!– Record user details –> <AuditPath key="person"> <RecordValue key="roles" dataExtractor="userRoles"/> <GenerateValue key="fullName" dataGenerator="personFullName"/> </AuditPath> <!– Record a description of the event –> <AuditPath key="name"> <RecordValue key="value" dataExtractor="simpleValue"/> </AuditPath> <!– Record the node's details –> <AuditPath key="node"> <RecordValue key="noderef" dataExtractor="simpleValue"/> <RecordValue key="name" dataExtractor="nodeName"/> <RecordValue key="type" dataExtractor="nodeType"/> <RecordValue key="namePath" dataExtractor="namePath"/> <RecordValue key="nodeRefPath" dataExtractor="nodeRefPath"/> <RecordValue key="identifier" dataExtractor="nodeIdentifier"/> <AuditPath key="changes"> <AuditPath key="before"> <RecordValue key="value" dataExtractor="simpleValue"/> </AuditPath> <AuditPath key="after"> <RecordValue key="value" dataExtractor="simpleValue"/> </AuditPath> </AuditPath> </AuditPath> <!– RM action parameters * Keyed by action name to be more selective * Only record the parameters if they are of interest –> <!– A test action –> <AuditPath key="testAction"> <AuditPath key="parameters"> <AuditPath key="testActionParam"> <RecordValue key="value" dataExtractor="simpleValue"/> </AuditPath> </AuditPath> </AuditPath> </AuditPath> <AuditPath key="login"> <AuditPath key="args"> <AuditPath key="userName"> <RecordValue key="value" dataExtractor="simpleValue"/> </AuditPath> </AuditPath> <AuditPath key="no-error"> <GenerateValue key="fullName" dataGenerator="personFullName"/> </AuditPath> <AuditPath key="error"> <RecordValue key="value" dataExtractor="nullValue"/> </AuditPath> </AuditPath> <AuditPath key="visorSignatures"> <AuditPath key="userName"> <RecordValue key="value" dataExtractor="simpleValue"/> </AuditPath> <AuditPath key="fullName"> <RecordValue key="value" dataExtractor="simpleValue"/> </AuditPath> <AuditPath key="source"> <RecordValue key="value" dataExtractor="simpleValue"/> </AuditPath> </AuditPath> <AuditPath key="consultaDocument"> <AuditPath key="userName"> <RecordValue key="value" dataExtractor="simpleValue"/> </AuditPath> <AuditPath key="fullName"> <RecordValue key="value" dataExtractor="simpleValue"/> </AuditPath> <AuditPath key="source"> <RecordValue key="value" dataExtractor="simpleValue"/> </AuditPath> </AuditPath> </Application> </Audit>