I am having a event handler. It gets trigger when ever there is any change in node property.
Inside that event handler, how can I get which user changed the property. I want to get username / user id. Is there any way apart from lastmodified date of node
Thanks alot in advance
Solved! Go to Solution.
Hi,
I don't think, that the jcr:lastModified and jcr:lastModifiedBy properties are updated on every change on a node. Otherwise every node should have these properties, and this isn't the case.
A sling resource event (which indicates a change to a resource) always logs the user, which has executed the changed. But with Oak this is true only for local changes, changes performed on a different cluster node have the user "oak:unknown". For this reason you should run this event listener on every cluster node and only check local changes.
kind regards,
Jörg
Views
Replies
Total Likes
If you are tracking on the Node property changed, the user who changed would be captured under jcr:content with the property cq:lastModifiedBy
Let me know if you are looking at something else
Hi,
I don't think, that the jcr:lastModified and jcr:lastModifiedBy properties are updated on every change on a node. Otherwise every node should have these properties, and this isn't the case.
A sling resource event (which indicates a change to a resource) always logs the user, which has executed the changed. But with Oak this is true only for local changes, changes performed on a different cluster node have the user "oak:unknown". For this reason you should run this event listener on every cluster node and only check local changes.
kind regards,
Jörg
Views
Replies
Total Likes
Thanks for reponse @bsloki,
let say the node property name is 'mydata'.
Now when this property gets changes, two things will happen.
Task 1. cq:lastModifiedBy will get updated. ( Default AEM Behavior)
Task 2. My Event listener will get fired ( My Code)
Is there any possiblity that task 2 occur before task 1, which will give me old value not updated one in event listener. Whats your views in this case......
Views
Replies
Total Likes
In Oak the user id in events is not guaranteed to be the actual user, events from other cluster nodes is just one scenario where that is true. The other known scenario is when too many events are being generated too fast, in which case multiple events get coalesced without respect for which user generated which event. AFAIK...
-Rob Ryan
Views
Replies
Total Likes
In an JCR node event handler - the nodes are updated before the event handler is invoked. That is, the handler listens for the node events. See:
http://blogs.adobe.com/experiencedelivers/experience-management/event_handling_incq/
As @Scott mentioned, it shouldnt be the case as the actual action happens ie. update of a property along with which the lastModifiedBy will also be updated. Once that is saved successfully Event handler get triggered.
Thanks for answer and views guys, @scott, @bsloki
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies