Hello,
AEM: 6.2
I have a use case where on inject properties of a component, my sling model executes a @PostConstruct method to configure a state of content by setting a node property value. For example:
@PostConstruct
protected void setProperty() {
try {
ModifiableValueMap map = this.resource.adaptTo(ModifiableValueMap.class);
(*) map.put("customProperty", "initalStateValue");
resource.getResourceResolver().commit();
} catch (PersistenceException e) {
LOGGER.error(e);
}
}
Now, when i publish a page which uses this AEM component, the anonymous user on the published site gets an error message:
On further analysis: I have found that since "anonymous" user does not have permissions to write on /content nodes, the statement marked above with an (*) sets map object to null.
My Question is: Is there a better implementation pattern to achieve the scenario of configuring the state of content node such that the state of the content can be set through node property only for authors?
Views
Replies
Total Likes
Hi sud.varun,
this is a duplicate question to "http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage..." initiated by you. Since that one had some response please follow up on that one and kindly close this one.
Thanks
Views
Replies
Total Likes
Via runmodes you can have this code only run on your author instance.
Views
Replies
Total Likes