Return-Path: Delivered-To: apmail-jackrabbit-dev-archive@www.apache.org Received: (qmail 43486 invoked from network); 7 Aug 2009 10:50:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 7 Aug 2009 10:50:17 -0000 Received: (qmail 40674 invoked by uid 500); 7 Aug 2009 10:50:23 -0000 Delivered-To: apmail-jackrabbit-dev-archive@jackrabbit.apache.org Received: (qmail 40609 invoked by uid 500); 7 Aug 2009 10:50:23 -0000 Mailing-List: contact dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list dev@jackrabbit.apache.org Received: (qmail 40601 invoked by uid 99); 7 Aug 2009 10:50:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Aug 2009 10:50:23 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of arcassis@gmail.com designates 209.85.221.194 as permitted sender) Received: from [209.85.221.194] (HELO mail-qy0-f194.google.com) (209.85.221.194) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Aug 2009 10:50:15 +0000 Received: by qyk32 with SMTP id 32so1321163qyk.15 for ; Fri, 07 Aug 2009 03:49:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=wYkaPqNch5FMAqlTq9SsP94V6GkBTuadNI4lPt9aVPU=; b=mFZFWr51qcak1emOFj95bmwEw+SjprH0of+55z4rg50uyctI1ttOPegn+Yd3BuIW7c TueahW7hB8EyPSOiEs5Lb18ztp55tpy//59jlIpAO2gRVFzrf9CRsnZwxqG8rZdMaGe4 QpdG1kJjH3Ald83CJtk8RR3g2ay5CXw7LJH0M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=rIV7A7arkvPq1pnFLG/rFbqFUId8L3kAwJkrdNhPzc0DgCZg1G9sInB9T2Kk2ey/Xr nOfDS848RKu+ayDmXOV6MHauK1VCbBoFOvqwqP2N+NFZJkWDUuXgFXSg18smef9zrO4z oFK3ZfNLkaj9t+DCb1boN1M9QnH7YMZvp0ovA= MIME-Version: 1.0 Received: by 10.224.37.83 with SMTP id w19mr921203qad.132.1249642194589; Fri, 07 Aug 2009 03:49:54 -0700 (PDT) In-Reply-To: References: Date: Fri, 7 Aug 2009 13:49:54 +0300 Message-ID: Subject: Problem with SimpleAccessControl.setPolicy From: "arcassis@gmail.com" To: dev@jackrabbit.apache.org Content-Type: multipart/alternative; boundary=0015175caa7c1ad8bd04708aff35 X-Virus-Checked: Checked by ClamAV on apache.org --0015175caa7c1ad8bd04708aff35 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit ---------- Forwarded message ---------- From: arcassis@gmail.com Date: Thu, Aug 6, 2009 at 9:29 PM Subject: Problem with SimpleAccessControl.setPolicy To: dev-info@jackrabbit.apache.org Hello, I'm using Jackrabbit in one of my projects and now I've came to implement the security part. After some readings I've found out that the documentation from jsr283 is the best starting point in implementing security in a Jackrabbit based project. I need to set pairs of Principal-Privilege[] on a node, so I tried the following: SessionImpl s = rep.login(new SimpleCredentials("myUser", "myPassword".toCharrArray())); AccessControlManager acm = s.getAccessControlManager(); Principal p_myUser = new PrincipalImpl("myUser"); Privilege[] privs = new Privilege[] {acm.privilegeFromName("jcr:write")}; MyAccessControlList acl = new MyAccessControlList(); acl.addAccessControlEntry(p_myUser, privs); acm.setPolicy(absPath, acl); acm.setPolicy() The problem is that setPolicy method, innvoked on SimpleAccessControlManager throws always an exception - AccessControlException. So the method is not implemented IN SimpleAccessControlManager, it's called the method from AbstractAccessControlManager. After all mentioned above I've tried the folowing: Node theNode = s.getNode(absPath); Node policy = theNode.addNode("rep:policy", "rep:ACL"); Node accessControlEntry = policy.addNode("ace1", "rep:GrantACE"); accessControlEntry.setProperty("rep:principalName", "ionel"); accessControlEntry.setProperty("rep:privileges", new String[] {"jcr:write"}); accessControlEntry.setProperty("rep:nodePath", theNode.getPath()); but I get the folowing exception: javax.jcr.nodetype.ConstraintViolationException: node /category_X/rep:policy: cannot add a child to a protected node. The node that I want to set a Policy on is a rep:AccessControllable node type. So, how can I set an access control list on a node ? I appreciate any help ! Thanks Damian Daniel -- Arcassis --0015175caa7c1ad8bd04708aff35 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

---------- Forwarded message ----------<= br>From: arcassis@gmail.com <arcassis@gmail.com>
Date: Thu, Aug 6, 2009 at 9:29 PM
Subject: Problem with SimpleAccessCont= rol.setPolicy
To: dev-= info@jackrabbit.apache.org


Hello,

I'm using Jackr= abbit in one of my projects=A0 and now I've came to implement the secur= ity part.

After some readings I've found out that the documentation from jsr2= 83 is the best starting point in implementing security in a Jackrabbit base= d project.

I need to set pairs of Principal-Privilege[] on a node, so I tried the = following:
SessionImpl s =3D rep.login(new SimpleCredentials("myUse= r", "myPassword".toCharrArray()));
AccessControlManager a= cm =3D s.getAccessControlManager();

Principal p_myUser =3D new PrincipalImpl("myUser");
Privil= ege[] privs =3D new Privilege[] {acm.privilegeFromName("jcr:write"= ;)};
MyAccessControlList acl =3D new MyAccessControlList();
acl.addAc= cessControlEntry(p_myUser, privs);
acm.setPolicy(absPath, acl);
acm.setPolicy()

The pr= oblem is that setPolicy method, innvoked on SimpleAccessControlManager thro= ws always an exception - AccessControlException.
So the method is not im= plemented IN SimpleAccessControlManager, it's called the method from Ab= stractAccessControlManager.

After all mentioned above I've tried the folowing:

Node theN= ode =3D s.getNode(absPath);
Node policy =3D theNode.addNode("rep:po= licy", "rep:ACL");
Node accessControlEntry =3D policy.add= Node("ace1", "rep:GrantACE");
accessControlEntry.setProperty("rep:principalName", "ionel&q= uot;);
accessControlEntry.setProperty("rep:privileges", new St= ring[] {"jcr:write"});
accessControlEntry.setProperty("re= p:nodePath", theNode.getPath());

but I get the folowing=A0 exception:
javax.jcr.nodetype.ConstraintVi= olationException: node /category_X/rep:policy: cannot add a child to a prot= ected node.

The node that I want to set a Policy on is a rep:AccessC= ontrollable node type.

So, how can I set an access control list on a node ?

I appreciat= e any help !

Thanks

Damian Daniel



--
Arcassis
--0015175caa7c1ad8bd04708aff35--