Try the below code. Just pass the user id and resourceResolverFactory instance.
private ResourceResolver getImpersonatedResolver(final String userId) {
try {
return resourceResolverFactory.getAdministrativeResourceResolver(Collections.singletonMap(ResourceResolverFactory.USER_IMPERSONATION, (Object) userId));
} catch (LoginException e) {
throw new RuntimeException(e);
}
}
No comments:
Post a Comment
If you have any doubts or questions, please let us know.