Hi Marc,

> 1. AccessControlUtil.addEntry() throws "java.lang.NoSuchMethodException:
> org.apache.jackrabbit.core.security.authorization.acl.ACLTemplate.addEntry()"
> as rootCause. I use <Import-Package>*;resolution:=optional</Import-Package>
> for that bundle and the following code.
>
> accessController = AccessControlUtil.getAccessControlManager(session);
> AccessControlPolicyIterator applicablePolicies =
> accessController.getApplicablePolicies(pagePath);
> AccessControlList acl = (AccessControlList)
> applicablePolicies.nextAccessControlPolicy();
> Privilege[] supportedPrivileges =
> accessController.getSupportedPrivileges(pagePath);
> AccessControlUtil.addEntry(acl, userPrincipal, supportedPrivileges, false);
> accessController.setPolicy(pagePath, acl);
>
> What's wrong here?

Please, you can try this instead:

acl.addAccessControlEntry(userPrincipal, supportedPrivileges);
accessController.setPolicy(path_to_apply_policy, acl);
session.save();

where session is the opened jcr session over security workspace.

Hope this helps.

Regards,

Juanjo.

Reply via email to