HI,
On Adobe Aem 6.4 Author, is it possible to prevent two editors, with the same permissions, from simultaneously modifying the same component/object within a page?
Thank you
Solved! Go to Solution.
Views
Replies
Total Likes
Hello @robertol6836527 ,
By default, AEM doesn't provide a built-in mechanism to lock individual components, but you have the option to lock the entire page.
For a custom solution, you can implement a mechanism to lock and unlock nodes based on specific events. This can be achieved by introducing custom logic that sets a property (e.g., cmpState
) on the node. If cmpState
is true, you can disable editing using the filter suggested by @Nikita___Garg .
Additionally, it's essential to establish a centralized place where users can find and unlock components, especially in urgent situations. Consider implementing a feature that allows users to release the lock (remove the cmpState
property) when necessary.
This approach provides a flexible and customizable solution for component locking in AEM.
Hi @robertol6836527 ,
This functionality is not OOTB available but can be achieved using customization. @arunpatidar has written a blog to achieve this use case. AEM Lab - Arun Patidar: AEM - Restrict Component Editing and Allowed Only for Certain Users . Please check if this is something you want to achieve at component level.
Thanks,
Nikita Garg
HI,
Thanks for the reply.
I checked all the articles on the site but there is no one that solves my problem.
I would like to avoid having two editors modify the same object/component at the same time.
Thank you
haev you tried locking the page?
HI,
I would just like to avoid having two editors modify the same object/component. Different objects on the same page must be able to be edited.
Thank you
Do you mean If a content author has opened a component dialog, any other author shouldn't be able to edit it until first author clicks ok and close it?
If this is the use case, you can try something like this-
1. As an author opens a dialog, create a property on component node using listener.
2. If that property is present in the component node, hide/disable all fields in dialog when any other author opens that dialog.
3. As soon as first author closes/save the dialog, clear the property.
Some edge case scenarios may have to thought through to make sure the it doesn't break in any scenario.
Hi @robertol6836527 ,
What I understood from your statement is that "simultaneously" implies that lets consider Author 1 has a state of the component authoring , lets say state 1 and then another author Author 2 has same state of the component authoring, i.e. state 1.
Now Author 1 authors the component thus moving to State 2 but Author 2 is still authoring the component on top of State 1.
If you do not want above thing to happen, what you can do is a simple check.
Whenever you load the editor mode of the page, load the cq:lastModified Timestamp in a data attribute on the component.
Then when you let the author configure the component and click save on the component dialog, make a call via JS listener to check the last modified timestamp of the component node in jcr.
If it equals the timestamp in the data attribute, allow the author to save.
If not then use a granite alert to ask the author to refresh the page before authoring again.
Hello @robertol6836527 ,
By default, AEM doesn't provide a built-in mechanism to lock individual components, but you have the option to lock the entire page.
For a custom solution, you can implement a mechanism to lock and unlock nodes based on specific events. This can be achieved by introducing custom logic that sets a property (e.g., cmpState
) on the node. If cmpState
is true, you can disable editing using the filter suggested by @Nikita___Garg .
Additionally, it's essential to establish a centralized place where users can find and unlock components, especially in urgent situations. Consider implementing a feature that allows users to release the lock (remove the cmpState
property) when necessary.
This approach provides a flexible and customizable solution for component locking in AEM.
Views
Likes
Replies
Views
Likes
Replies