Hey guys!

I'm currently in need of a way to check all website nodes for a given user.
I have declared a few roles and groups, which permit read/write access and 
which prohibit access to some nodes.

But now I need to check which nodes could be seen by the specific user in the 
website tree.
I guess it should be done like this:

[code]
public Collection<String> getReadAccess(){
      Collection<String> accessList = new ArrayList<String>();
        Session session = 
MgnlContext.getHierarchyManager("website").getWorkspace().getSession();
        try {
                        Session importsonatedSession = session.
                                        impersonate(new 
SimpleCredentials(this.username, this.password));
                        Node rootNode = importsonatedSession.getRootNode();
                        NodeIterator it = rootNode.getNodes();
                        while(it.hasNext()){
                                Node node = it.nextNode();
                                System.out.println("DEBUG:::: "+node.getPath());
                                try {
                                        
importsonatedSession.checkPermission(node.getPath(), "read, add_node");
                                        accessList.add(node.getUUID());
                                } catch 
(UnsupportedRepositoryOperationException e) {
                                        //do nothing
                                } catch (AccessControlException e) {
                                        System.out.println("Node: 
"+node.getPath()+" is not allowed!");
                                }
                        }
                } catch (LoginException e) {
                        e.printStackTrace();
                } catch (RepositoryException e) {
                        e.printStackTrace();
                }
        return accessList;
    }
[/code]

Lets say I have a total of 8 root nodes in the website tree as superuser. 
test_user has the permission to work with 3 of these nodes. If I log in as 
test_user I can also see only those 3.
But this code does not work... the AccessControlException is never raised. The 
accessList is filled with all 8 nodes...

I am using JCR 1.0 with magnolia 4.4.8.
Any ideas what I could do, to get this working?

Thanks a lot in advance :)

Best,
Daniel

-- 
Context is everything: 
http://forum.magnolia-cms.com/forum/thread.html?threadId=ed9cb831-5d6a-4e43-a746-090cf0347cd3


----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to