Hi
how do we retrieve resourceresolver on behalf of logged in user? in this case, am getting anonymous as value when getUserID() method is called. Also, what's the difference when we retrieve resource resolver via getResourceResolver(userInfo) and getThreadResourceResolver(). From the logs seems like they both reference to same resolver object instance and no difference in log values.
Map<String,Object> userInfo = new HashMap<String, Object>();
userInfo.put(ResourceResolverFactory.SUBSERVICE, "myuser");
ResourceResolver resourceResolver = resourceFactory.getResourceResolver(userInfo);
ResourceResolver resourceResolverCurrentThread = resourceFactory.getThreadResourceResolver();
logger.info("resource resolver {}",resourceResolver.toString());
logger.info("resource resolver {}",resourceResolver.getUserID());
logger.info("resource resolver {}",resourceResolver.isLive());
logger.info("thread resource resolver {}",resourceResolverCurrentThread.toString());
logger.info("thread resource resolver {}",resourceResolver.getUserID());
logger.info("thread resource resolver {}",resourceResolver.isLive());
Solved! Go to Solution.
Views
Replies
Total Likes
If you pass through things like resourceResolver / resource from user's request you get the right object/permissions based on the user.
When getting the resource-resolver via the factory it is disconnected from the user
Views
Replies
Total Likes
Hi
how do we retrieve from resourceresolver of user request?
Views
Replies
Total Likes
request.getResourceResolver()
https://docs.adobe.com/docs/en/aem/6-1/ref/javadoc/org/apache/sling/api/SlingHttpServletRequest.html
Views
Likes
Replies