public class AccessAuditor extends Object implements org.springframework.beans.factory.InitializingBean, NodeServicePolicies.BeforeDeleteNodePolicy, NodeServicePolicies.OnAddAspectPolicy, NodeServicePolicies.OnCreateNodePolicy, NodeServicePolicies.OnMoveNodePolicy, NodeServicePolicies.OnRemoveAspectPolicy, NodeServicePolicies.OnUpdatePropertiesPolicy, ContentServicePolicies.OnContentReadPolicy, ContentServicePolicies.OnContentUpdatePolicy, VersionServicePolicies.OnCreateVersionPolicy, CopyServicePolicies.OnCopyCompletePolicy, CheckOutCheckInServicePolicies.OnCheckOut, CheckOutCheckInServicePolicies.OnCheckIn, CheckOutCheckInServicePolicies.OnCancelCheckOut
To turn on auditing of these events and sub events add the following property to alfresco-global.properties:
# Enable audit in general audit.enabled=true # Enable the alfresco-access audit application audit.alfresco-access.enabled=true # Enable the auditing of sub-actions. Normally disabled as these values are # not normally needed by audit configurations, but may be useful to developers audit.alfresco-access.sub-actions.enabled=trueThe following properties are set by default to discard events where the user is 'null' or 'System', the node path is '/sys:archivedItem' or under '/ver:' or the node type is not 'cm:folder', 'cm:content' or 'st:site'. These values result in events only being recorded for common actions initiated by users of the system. These vales may be overridden if required.
audit.filter.alfresco-access.default.enabled=true audit.filter.alfresco-access.transaction.user=~System;~null;.* audit.filter.alfresco-access.transaction.type=cm:folder;cm:content;st:site audit.filter.alfresco-access.transaction.path=~/sys:archivedItem;~/ver:;.*Node and Content changes generate the following audit structure. Elements are omitted if not changed by the transaction. The
/sub-action/<sequence>
structure holds
cut down details of each sub-action, but are only included if the global property
audit.alfresco-access.sub-actions.enabled=true
.
/alfresco-access /transaction /action=<actionName> /sub-actions=<sub action list> /path=<prefixPath> /type=<prefixType> /node=<nodeRef> /user=<user> /copy /from /node=<nodeRef> /path=<prefixPath> /type=<prefixType> /move /from /node=<nodeRef> /path=<prefixPath> /type=<prefixType> /properties /from=<mapOfValues> /<propertyName>=<propertyValue> /to=<mapOfValues> /<propertyName>=<propertyValue> /add=<mapOfValues> /<propertyName>=<propertyValue> /delete=<mapOfValues> /<propertyName>=<propertyValue> /aspects /add=<mapOfNames> /<aspectName>=null /delete=<mapOfNames> /<aspectName>=null /version-properties=<mapOfValues> /sub-action/<sequence> /action=<actionName> /move ... /properties ... /aspects ... Example data: /alfresco-access/transaction/action=MOVE /alfresco-access/transaction/node=workspace://SpacesStore/74a5985a-45dd-4698-82db-8eaeff9df8d7 /alfresco-access/transaction/move/from/node=workspace://SpacesStore/d8a0dfd8-fe45-47da-acc2-fd8df9ea2b2e /alfresco-access/transaction/move/from/path=/app:company_home/st:sites/cm:abc/cm:documentLibrary/cm:folder1/cm:Word 123.docx /alfresco-access/transaction/move/from/type=cm:folder /alfresco-access/transaction/path=/app:company_home/st:sites/cm:abc/cm:documentLibrary/cm:folder2/cm:Word 123.docx /alfresco-access/transaction/sub-actions=moveNode readContent /alfresco-access/transaction/type=cm:content /alfresco-access/transaction/user=admin /alfresco-access/transaction/sub-action/00/action=moveNode /alfresco-access/transaction/sub-action/00/move/from/node=workspace://SpacesStore/d8a0dfd8-fe45-47da-acc2-fd8df9ea2b2e /alfresco-access/transaction/sub-action/00/move/from/path=/app:company_home/st:sites/cm:abc/cm:documentLibrary/cm:folder1/cm:Word 123.docx /alfresco-access/transaction/sub-action/00/move/from/type=cm:folder /alfresco-access/transaction/sub-action/01/action=readContentThe trace output from this class may be useful to developers as it logs method calls grouped by transaction. The debug output is of the audit records written and full inbound audit data. However for developers trace will provide a more readable form. Setting the following dev-log4j.properties:
log4j.appender.File.Threshold=trace log4j.logger.org.alfresco.repo.audit.access.AccessAuditor=trace
Policy.Arg
QNAME
QNAME
QNAME
QNAME
QNAME
ARG_0, ARG_1, ARG_2, QNAME
QNAME
QNAME
QNAME
QNAME
QNAME
QNAME
QNAME
Constructor and Description |
---|
AccessAuditor() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Checks that all necessary properties have been set and binds with the policy component.
|
void |
beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Called before a node is deleted.
|
void |
onAddAspect(org.alfresco.service.cmr.repository.NodeRef nodeRef,
org.alfresco.service.namespace.QName aspect)
Called after an aspect has been added to a node
|
void |
onCancelCheckOut(org.alfresco.service.cmr.repository.NodeRef nodeRef) |
void |
onCheckIn(org.alfresco.service.cmr.repository.NodeRef nodeRef) |
void |
onCheckOut(org.alfresco.service.cmr.repository.NodeRef workingCopy) |
void |
onContentRead(org.alfresco.service.cmr.repository.NodeRef nodeRef) |
void |
onContentUpdate(org.alfresco.service.cmr.repository.NodeRef nodeRef,
boolean newContent) |
void |
onCopyComplete(org.alfresco.service.namespace.QName classRef,
org.alfresco.service.cmr.repository.NodeRef sourceNodeRef,
org.alfresco.service.cmr.repository.NodeRef targetNodeRef,
boolean copyToNewNode,
Map<org.alfresco.service.cmr.repository.NodeRef,org.alfresco.service.cmr.repository.NodeRef> copyMap) |
void |
onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef)
Called when a new node has been created.
|
void |
onCreateVersion(org.alfresco.service.namespace.QName classRef,
org.alfresco.service.cmr.repository.NodeRef nodeRef,
Map<String,Serializable> versionProperties,
PolicyScope nodeDetails)
Called during the creation of the version to determine what the versioning policy for a
perticular type may be.
|
void |
onMoveNode(org.alfresco.service.cmr.repository.ChildAssociationRef fromChildAssocRef,
org.alfresco.service.cmr.repository.ChildAssociationRef toChildAssocRef)
Called when a node has been moved.
|
void |
onRemoveAspect(org.alfresco.service.cmr.repository.NodeRef nodeRef,
org.alfresco.service.namespace.QName aspect)
Called after an aspect has been removed from a node
|
void |
onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef nodeRef,
Map<org.alfresco.service.namespace.QName,Serializable> fromProperties,
Map<org.alfresco.service.namespace.QName,Serializable> toProperties)
Called after a node's properties have been changed.
|
void |
setAuditComponent(AuditComponent auditComponent)
The component to create audit events
|
void |
setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService)
Set the component used to resolve namespaces.
|
void |
setNodeInfoFactory(NodeInfoFactory nodeInfoFactory)
Set the component used to create
NodeInfo objects. |
void |
setPolicyComponent(PolicyComponent policyComponent)
Set the component used to bind to behaviour callbacks
|
void |
setProperties(Properties properties)
Set the properties object holding filter configuration
|
void |
setTransactionService(TransactionService transactionService)
Set the component used to start new transactions
|
public void setProperties(Properties properties)
public void setPolicyComponent(PolicyComponent policyComponent)
public void setAuditComponent(AuditComponent auditComponent)
public void setTransactionService(TransactionService transactionService)
public void setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService)
public void setNodeInfoFactory(NodeInfoFactory nodeInfoFactory)
NodeInfo
objects.public void afterPropertiesSet()
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
public void beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef nodeRef)
NodeServicePolicies.BeforeDeleteNodePolicy
beforeDeleteNode
in interface NodeServicePolicies.BeforeDeleteNodePolicy
nodeRef
- the node referencepublic void onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef)
NodeServicePolicies.OnCreateNodePolicy
onCreateNode
in interface NodeServicePolicies.OnCreateNodePolicy
childAssocRef
- the created child association referencepublic void onMoveNode(org.alfresco.service.cmr.repository.ChildAssociationRef fromChildAssocRef, org.alfresco.service.cmr.repository.ChildAssociationRef toChildAssocRef)
NodeServicePolicies.OnMoveNodePolicy
onMoveNode
in interface NodeServicePolicies.OnMoveNodePolicy
fromChildAssocRef
- the child association reference prior to the movetoChildAssocRef
- the child association reference after the movepublic void onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef nodeRef, Map<org.alfresco.service.namespace.QName,Serializable> fromProperties, Map<org.alfresco.service.namespace.QName,Serializable> toProperties)
NodeServicePolicies.OnUpdatePropertiesPolicy
onUpdateProperties
in interface NodeServicePolicies.OnUpdatePropertiesPolicy
nodeRef
- reference to the updated nodefromProperties
- the node's properties before the changetoProperties
- the node's properties after the changepublic void onRemoveAspect(org.alfresco.service.cmr.repository.NodeRef nodeRef, org.alfresco.service.namespace.QName aspect)
NodeServicePolicies.OnRemoveAspectPolicy
onRemoveAspect
in interface NodeServicePolicies.OnRemoveAspectPolicy
nodeRef
- the node from which the aspect will be removedaspect
- the type of the aspectpublic void onAddAspect(org.alfresco.service.cmr.repository.NodeRef nodeRef, org.alfresco.service.namespace.QName aspect)
NodeServicePolicies.OnAddAspectPolicy
onAddAspect
in interface NodeServicePolicies.OnAddAspectPolicy
nodeRef
- the node to which the aspect was addedaspect
- the type of the aspectpublic void onContentUpdate(org.alfresco.service.cmr.repository.NodeRef nodeRef, boolean newContent)
onContentUpdate
in interface ContentServicePolicies.OnContentUpdatePolicy
nodeRef
- the node referencepublic void onContentRead(org.alfresco.service.cmr.repository.NodeRef nodeRef)
onContentRead
in interface ContentServicePolicies.OnContentReadPolicy
nodeRef
- the node referencepublic void onCreateVersion(org.alfresco.service.namespace.QName classRef, org.alfresco.service.cmr.repository.NodeRef nodeRef, Map<String,Serializable> versionProperties, PolicyScope nodeDetails)
VersionServicePolicies.OnCreateVersionPolicy
onCreateVersion
in interface VersionServicePolicies.OnCreateVersionPolicy
classRef
- the class referencenodeRef
- the versionable node referenceversionProperties
- the version propertiesnodeDetails
- the details of the node to be versionedpublic void onCopyComplete(org.alfresco.service.namespace.QName classRef, org.alfresco.service.cmr.repository.NodeRef sourceNodeRef, org.alfresco.service.cmr.repository.NodeRef targetNodeRef, boolean copyToNewNode, Map<org.alfresco.service.cmr.repository.NodeRef,org.alfresco.service.cmr.repository.NodeRef> copyMap)
onCopyComplete
in interface CopyServicePolicies.OnCopyCompletePolicy
classRef
- the type of the node that was copiedsourceNodeRef
- the original nodetargetNodeRef
- the destination nodecopyMap
- a map containing all the nodes that have been created during the copypublic void onCheckOut(org.alfresco.service.cmr.repository.NodeRef workingCopy)
onCheckOut
in interface CheckOutCheckInServicePolicies.OnCheckOut
workingCopy
- - working copypublic void onCheckIn(org.alfresco.service.cmr.repository.NodeRef nodeRef)
onCheckIn
in interface CheckOutCheckInServicePolicies.OnCheckIn
nodeRef
- NodeRefpublic void onCancelCheckOut(org.alfresco.service.cmr.repository.NodeRef nodeRef)
onCancelCheckOut
in interface CheckOutCheckInServicePolicies.OnCancelCheckOut
nodeRef
- NodeRefCopyright © 2005–2017 Alfresco Software. All rights reserved.