Thanks Angela,
Through a bit of trial and error I have the following which works as
expected.
AccessControlPolicyIterator it =
adminAcm.getApplicablePolicies(testRootNode.getPath());
while ( it.hasNext() ) {
AccessControlPolicy acp = it.nextAccessControlPolicy();
Privilege[] privileges = new
Privilege[]{adminAcm.privilegeFromName(Privilege.JCR_WRITE)};
((AbstractACLTemplate)acp).addEntry(new
PrincipalImpl(anonymous.getUserID()), privileges, true);
adminAcm.setPolicy(testRootNode.getPath(), acp);
}
superuser.save();
It seems odd to me that I have to cast the AcessControlPolicy
to AbstractACLTemplate inorder, which is JackRabbit specific to add a new
entry. I wonder what the JCR 2 api dose not define an interface?
Regards
Ben Short
2009/12/4 Angela Schreiber <[email protected]>
> please take a look at the API.
>
> AccessControlManager#getApplicablePolicies
>
> -> for policies that can but haven't yet been applied
>
> AccessControlManager#getPolicies
>
> -> for policies that have been applied at a given path
> and can be removed again or edited/reapplied
>
> angela
>