Hi,
I am trying to find a user or user group who has access to the Page resource using APIs (Jackrabbit APIs) . I could not find any API which gives the Users or User Group of page resource. For ex: i have a page resource /content/geometrix/mens.html , first i want to find out what user group has access to this resource. Use case for this scenarios is: Authors or users should have only read only access to that page.
Sri.
Solved! Go to Solution.
As smacdonald2008 mentioned you need a business logic to handle this in your servlet.
UserManager (Adobe AEM 6.0.0 API 6.0.0 API) provides it.
look into this
Iterator<Authorizable> | findAuthorizables(Query query) Return Authorizable s that match a specific Query . |
Iterator<Authorizable> | findAuthorizables(String relPath, String value) Returns all Authorizable s that have a property with the given relative path (or name) that matches the specified value. |
Iterator<Authorizable> | findAuthorizables(String relPath, String value, int searchType) Returns all Authorizable s that have a property with the given relative path (or name) that matches the specified value. |
Authorizable | getAuthorizable(Principal principal) Get the Authorizable by its Principal. |
Authorizable | getAuthorizable(String id) Get the Authorizable by its id. |
Views
Replies
Total Likes
public boolean hasWriteAccess(Resource resource , Session userSession) throws RepositoryException {
Node pageNode = resource.adaptTo(Node.class);
String path = pageNode.getPath();
try {
userSession.checkPermission(path, "add_node,set_property");
if(pageNode.hasNode(JcrConstants.JCR_CONTENT)) {
String contentNodePath = path + "/" + "jcr:content";
userSession.checkPermission(contentNodePath, "add_node,set_property");
}
} catch(java.security.AccessControlException e) {
return false;
}
return true;
}
reference :
Views
Replies
Total Likes
Excellent Response!!!
Views
Replies
Total Likes
I think my problem is not clear. Let me explain that again.
Author has created a page (Mens.html) and also a user (user1) . Author assigned read only Access to user 1 for Mens.html resource. I have made few changes in the Side kick bar and introduced a new option (Send Email). When clicked, it calls Servlet, passing only the resourcepath which is mens.html. Using this resource path, i need to find out which users or user groups are associated to it then dynamically revoke access to this page after sending email. User is other than the Author.
Views
Replies
Total Likes
" need to find out which users or user groups are associated to it" - meaning you want to find our which users has permissions. You still use the User Manager API.
As smacdonald2008 mentioned you need a business logic to handle this in your servlet.
UserManager (Adobe AEM 6.0.0 API 6.0.0 API) provides it.
look into this
Iterator<Authorizable> | findAuthorizables(Query query) Return Authorizable s that match a specific Query . |
Iterator<Authorizable> | findAuthorizables(String relPath, String value) Returns all Authorizable s that have a property with the given relative path (or name) that matches the specified value. |
Iterator<Authorizable> | findAuthorizables(String relPath, String value, int searchType) Returns all Authorizable s that have a property with the given relative path (or name) that matches the specified value. |
Authorizable | getAuthorizable(Principal principal) Get the Authorizable by its Principal. |
Authorizable | getAuthorizable(String id) Get the Authorizable by its id. |
Views
Replies
Total Likes
Ok. Does the UserManager api returns the Users which are associated to that resource page?
Ok Thank you. Let me try that.
Views
Replies
Total Likes
This Helps. Thanks a lot.
Views
Replies
Total Likes