jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aimran <aimra...@gmail.com>
Subject Re: Help with JCR 2 access control
Date Thu, 30 Sep 2010 18:32:40 GMT

Hi Justin,

I finally got a chance to try what you suggested. Unfortunately it doesn't
work. I followed your steps exactly:
Here are the extracts of the code:
- AccessControlPolicy[] policies =
session.getAccessControlManager().getPolicies(n.getPath());//root node
 for (AccessControlPolicy policy : policies) {
                if (policy instanceof AccessControlList) {
AccessControlList acl = AccessControlList.class.cast(policy);//OBTAINED THE
ACL
AccessControlEntry[] ent = acl.getAccessControlEntries();
                   
                    for (AccessControlEntry ace : ent) {
acl.removeAccessControlEntry(ace);//REMOVED ALL ENTRIES
}
}
session.save();
...
MyPrincipal admingroup_principal = new
MyPrincipal("Administrators");//CREATED NEW GROUP
admin_group = um.createGroup(admingroup_principal);
acl.addAccessControlEntry(admingroup_principal,
session.getAccessControlManager().getSupportedPrivileges(n.getPath()));
                       
session.getAccessControlManager().setPolicy(n.getPath(), policy);//ADDED THE
ACL FOR THE NEW GROUP
                        session.save();
}


Now if I login as guest and try to read the contents, the guest is still
able to access and read the workspace.

What am doing wrong? I have been banging my head over setting a simple
policy for hours. Went through the tests code, browsed forums, to no avail.
-- 
View this message in context: http://jackrabbit.510166.n4.nabble.com/Help-with-JCR-2-access-control-tp2403697p2739724.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Mime
View raw message