I have one scenario to discuss in programatically node creation in JCR with out administrative access.
Is there any way we can create node in publisher , lets say we hit the URL like below via dispatcher
http://example.domain.com/content/project/example.html
and in the component jsp we will write some code to create the node, if not present in Publisher JCR.
Right now the node creation is happening , but only when we logged in the publisher.
I need to create the node , with out logging to JCR .
Can anybody help?
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
In publish you are acessing the repository using the anonymous user, which does not have any write permission (which is a good thing). So you need to bypass this restriction, and the easiest and most secure way is to create a user, which has write access on the specific area, where you need to write. Nothing more. And then write a service, which uses this user's session to write the data. The service is called from your component.
But: I think, that in your design there are some shortcomings, when you need to create content nodes on publish in a non-UGC context. Carefully review if you can do this in a more controlled manner. Because you open a can of worms, if these write activities are not properly controlled.
kind regards,
Jörg
Views
Replies
Total Likes
I think you should probably take a look at comments component in AEM
There for every comment a node gets created., it uses anonymous user and sing default post servlet. have a look this page
Views
Replies
Total Likes
Hi,
In publish you are acessing the repository using the anonymous user, which does not have any write permission (which is a good thing). So you need to bypass this restriction, and the easiest and most secure way is to create a user, which has write access on the specific area, where you need to write. Nothing more. And then write a service, which uses this user's session to write the data. The service is called from your component.
But: I think, that in your design there are some shortcomings, when you need to create content nodes on publish in a non-UGC context. Carefully review if you can do this in a more controlled manner. Because you open a can of worms, if these write activities are not properly controlled.
kind regards,
Jörg
Views
Replies
Total Likes
You can create a Sling Servlet and bind it to the resource that is rendered at that URL. In the Sling Servlet - you can use the JCR API or SLing API to create nodes dynamically. Then make sure that you deploy the OSGi that contains the Sling Servlet to Pub.
For access to the JCR - make sure that you create a dedicated user account and that account has read/write privileges to the JCR location where you want to create nodes.
Views
Replies
Total Likes