AnsweredAssumed Answered

Auditing cmis

Question asked by mantoux on Aug 13, 2013
Latest reply on Aug 26, 2013 by mantoux
Hi, I am trying to setup auditing on Alfresco 4.2.
In another application I create documents in alfresco through cmis: folder.createDocument(…) and I need to audit this.
I'm trying to do this using /alfresco-api/post/NodeService/createNode, but it doesn't work. But when I create document using alfresco share it works. Audit config file is the same in both cases.
When I connected using debug to alfresco and called cmis folder.createDocument(…), was executed this method: NodeService.createNode(…), so it has to create new record in audit, because NodeService.createNode(…) is @Auditable, but it doesn't.
I had same problem with addProperties.
This is my audit config.

<?xml version='1.0' encoding='UTF-8'?>
<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="nodeNameValue" registeredName="auditModel.extractor.nodeName"/>
  </DataExtractors>
 
    <DataGenerators>
       <DataGenerator name="currentUser" registeredName="auditModel.generator.user"/>
       <DataGenerator name="systemTime" registeredName="auditModel.generator.time"/>
    </DataGenerators> 

  <PathMappings>
    <PathMap source="/alfresco-api/pre/NodeService/deleteNode" target="/preDelete" />
    <PathMap source="/alfresco-api/post/NodeService/deleteNode" target="/myaudit/postDelete" />
    <PathMap source="/alfresco-api/post/NodeService/createNode" target="/myaudit/createNode"/>
   <PathMap source="/alfresco-api/post/NodeService/addProperties" target="/myaudit/addProperties"/>
  </PathMappings>

  <Application name="PreCallDataDelete" key="preDelete">
    <RecordValue key="nodeName" dataExtractor="nodeNameValue" dataSource="/preDelete/args/nodeRef" dataTrigger="/preDelete/args/nodeRef" />
  </Application>

  <Application name="myaudit" key="myaudit">
    <RecordValue key="error" dataExtractor="simpleValue" dataSource="/myaudit/postDelete/error" dataTrigger="/myaudit/postDelete/error" />
    <AuditPath key="deleteDetails">
      <RecordValue key="deletedNodeRef" dataExtractor="simpleValue" dataSource="/myaudit/postDelete/args/nodeRef" dataTrigger="/myaudit/postDelete/args/nodeRef" />
      <RecordValue key="nodeName" dataExtractor="simpleValue" dataSource="/myaudit/postDelete/preCallData/preDelete/nodeName" dataTrigger="/myaudit/postDelete/preCallData/preDelete/nodeName" />
    </AuditPath>
    <AuditPath key="createNode">
      <AuditPath key="no-error">
        <RecordValue key="createdNodeRef" dataExtractor="simpleValue" dataSource="/myaudit/createNode/result"/>
        <RecordValue key="createdNodeName" dataExtractor="simpleValue" dataSource="/myaudit/createNode/args/assocQName"/>
      <RecordValue key="createdNodeParent" dataExtractor="nodeNameValue" dataSource="/myaudit/createNode/args/parentRef"/>
      <AuditPath key="error">
        <RecordValue key="createdNodeRef1" dataExtractor="simpleValue" dataSource="/myaudit/createNode/result"/>
        <RecordValue key="createdNodeName1" dataExtractor="simpleValue" dataSource="/myaudit/createNode/args/assocQName"/>
      <RecordValue key="createdNodeParent1" dataExtractor="nodeNameValue" dataSource="/myaudit/createNode/args/parentRef"/>
      </AuditPath>
      </AuditPath>
   </AuditPath>
   <AuditPath key="addProperties">
        <RecordValue key="modifiedPropsAdded" dataExtractor="simpleValue" dataSource="/myaudit/addProperties/args/nodeRef" dataTrigger="/myaudit/addProperties/args/nodeRef"/>
   </AuditPath>
  </Application>

</Audit>

Outcomes