jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Short <...@benshort.co.uk>
Subject Re: Using the AccessControlManager to set a policy
Date Fri, 04 Dec 2009 15:20:45 GMT
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 <anchela@day.com>

> 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
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message