jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Klimetschek <aklim...@day.com>
Subject Re: Set the permission(read/write/all) on a node
Date Fri, 16 Oct 2009 11:48:47 GMT
On Fri, Oct 16, 2009 at 08:08, rohit mittal <rohit78600@gmail.com> wrote:
> Hi users,
>
> I have used this configuration for access manager in repository.xml
>
>    <AccessManager
> class="org.apache.jackrabbit.core.security.DefaultAccessManager">
>           <!--  <param name="config" value="${rep.home}/access.xml"/>
> -->
>
>        </AccessManager>
>
>
>    AccessControlManager acManager = sessionImpl.getAccessControlManager();
>    AccessControlPolicy acPolicy = null;
>    AccessControlList acl = null;
>    String nodePath = folderNode.getPath();
>    AccessControlPolicyIterator policyIterator =
> acManager.getApplicablePolicies(nodePath);
>    if (policyIterator.hasNext())
>    {
>        acPolicy = policyIterator.nextAccessControlPolicy();
>    }
>    else
>    {
>        AccessControlPolicy[] existingPolicies =
> acManager.getPolicies(nodePath);
>        acPolicy = existingPolicies[0];
>    }
>    if (acPolicy instanceof AccessControlList)
>    {
>        acl = (AccessControlList) acPolicy;
>        Privilege[] privileges = {
> acManager.privilegeFromName(Privilege.JCR_ALL) };
>        Principal p_myUser = new PrincipalImpl("user1");
>        boolean flag = acl.addAccessControlEntry(p_myUser, privileges);
>        System.out.println("..........................." + flag);
>        acManager.setPolicy(nodePath, acl);
>        sessionImpl.save();
>        session.save();
>    }
>
>   In this code
>   acl.addAccessControlEntry(p_myUser, privileges);  always return false for
> when i login to user and its return true only for when i login to admin.

I guess that's because not everyone is allowed to set ACLs (there is a
separate right for that) and by default only the admin user is allowed
to do that (afaik).

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com

Mime
View raw message