alfresco-access get nodeRef, nodeid or nodeuuid

cancel
Showing results for 
Search instead for 
Did you mean: 
Muffex
Active Member II

alfresco-access get nodeRef, nodeid or nodeuuid

Jump to solution

Hello everyone,

since I was not able to gather nodeRef (a), nodeid (b) or nodeuuid (c) from the database (thread) I opted to use the alfresco-access api. I need to relate nodes to audit-log entries.


1. But as far as I understand there is also no way to get a/b/c for every entry? This information is only stored for some entries. How can I get a/b/c for every existing audit-log entry?

2. If there is absolutely no way to relate these items ootb. Can I modify the audit log so that the noderef is stored for every entry?

regards
Muffex

1 Solution

Accepted Solutions
Muffex
Active Member II

Re: alfresco-access get nodeRef, nodeid or nodeuuid

Jump to solution

I have been able to realize a solution. Smiley Happy

1. Create xml for a custom audit-application (c.f. Audit Log 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"/>
  </DataExtractors>

  <PathMappings>
    <PathMap source="/alfresco-access" target="/custom-audit" />
  </PathMappings>

  <Application name="custom-audit" key="custom-audit">
    <RecordValue
        key="action" dataExtractor="simpleValue"
        dataSource="/custom-audit/transaction/action"
        dataTrigger="/custom-audit/transaction/action" />
    <RecordValue
        key="sub-actions"
        dataExtractor="simpleValue"
        dataSource="/custom-audit/transaction/sub-actions"
        dataTrigger="/custom-audit/transaction/sub-actions" />  
    <RecordValue
        key="user" dataExtractor="simpleValue"
        dataSource="/custom-audit/transaction/user"
        dataTrigger="/custom-audit/transaction/user" />
    <RecordValue
        key="node"
        dataExtractor="simpleValue"
        dataSource="/custom-audit/transaction/node"
        dataTrigger="/custom-audit/transaction/node" />  
    <RecordValue
        key="type" dataExtractor="simpleValue"
        dataSource="/custom-audit/transaction/type"
        dataTrigger="/custom-audit/transaction/type" />  
    <RecordValue
        key="path" dataExtractor="simpleValue"
        dataSource="/custom-audit/transaction/path"
        dataTrigger="/custom-audit/transaction/path" />
  </Application>
</Audit>

2. Add xml-File to /usr/local/tomcat/shared/classes/alfresco/extension/audit/ on docker container (alfresco-ce-7_alfresco_1)

3. Restart Container

4. Access all the information you need (via curl: https://[host]:[port]/alfresco/service/api/audit/query/custom-audit?verbose=true)

best
Muffex

View solution in original post

3 Replies
afaust
Master

Re: alfresco-access get nodeRef, nodeid or nodeuuid

Jump to solution

You could override / replace Alfresco's default alfresco-audit-access.xml configuration (via WEB-INF/classes/alfresco/audit/ - AFAIK the extension classpath won't work as it would try to load a second alfresco-access audit application, running into an error with the already defined default application) to always record the node, since the node is actually always provided in the audit data generated by the producer - it is just not recorded via a RecordValue config.

Muffex
Active Member II
Muffex
Active Member II

Re: alfresco-access get nodeRef, nodeid or nodeuuid

Jump to solution

I have been able to realize a solution. Smiley Happy

1. Create xml for a custom audit-application (c.f. Audit Log 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"/>
  </DataExtractors>

  <PathMappings>
    <PathMap source="/alfresco-access" target="/custom-audit" />
  </PathMappings>

  <Application name="custom-audit" key="custom-audit">
    <RecordValue
        key="action" dataExtractor="simpleValue"
        dataSource="/custom-audit/transaction/action"
        dataTrigger="/custom-audit/transaction/action" />
    <RecordValue
        key="sub-actions"
        dataExtractor="simpleValue"
        dataSource="/custom-audit/transaction/sub-actions"
        dataTrigger="/custom-audit/transaction/sub-actions" />  
    <RecordValue
        key="user" dataExtractor="simpleValue"
        dataSource="/custom-audit/transaction/user"
        dataTrigger="/custom-audit/transaction/user" />
    <RecordValue
        key="node"
        dataExtractor="simpleValue"
        dataSource="/custom-audit/transaction/node"
        dataTrigger="/custom-audit/transaction/node" />  
    <RecordValue
        key="type" dataExtractor="simpleValue"
        dataSource="/custom-audit/transaction/type"
        dataTrigger="/custom-audit/transaction/type" />  
    <RecordValue
        key="path" dataExtractor="simpleValue"
        dataSource="/custom-audit/transaction/path"
        dataTrigger="/custom-audit/transaction/path" />
  </Application>
</Audit>

2. Add xml-File to /usr/local/tomcat/shared/classes/alfresco/extension/audit/ on docker container (alfresco-ce-7_alfresco_1)

3. Restart Container

4. Access all the information you need (via curl: https://[host]:[port]/alfresco/service/api/audit/query/custom-audit?verbose=true)

best
Muffex