Return-Path: X-Original-To: apmail-jackrabbit-users-archive@minotaur.apache.org Delivered-To: apmail-jackrabbit-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id F236618383 for ; Mon, 24 Aug 2015 18:01:51 +0000 (UTC) Received: (qmail 51615 invoked by uid 500); 24 Aug 2015 18:01:51 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 51562 invoked by uid 500); 24 Aug 2015 18:01:51 -0000 Mailing-List: contact users-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@jackrabbit.apache.org Delivered-To: mailing list users@jackrabbit.apache.org Received: (qmail 51010 invoked by uid 99); 24 Aug 2015 18:01:51 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Aug 2015 18:01:51 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id BAA271826D6 for ; Mon, 24 Aug 2015 18:01:50 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.88 X-Spam-Level: ** X-Spam-Status: No, score=2.88 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=3, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id Vu4PxEKISFlV for ; Mon, 24 Aug 2015 18:01:45 +0000 (UTC) Received: from mail-qk0-f173.google.com (mail-qk0-f173.google.com [209.85.220.173]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id 1624320F6D for ; Mon, 24 Aug 2015 18:01:45 +0000 (UTC) Received: by qkbm65 with SMTP id m65so79233109qkb.2 for ; Mon, 24 Aug 2015 11:01:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=uecxyW0rDhq8f8ve8MbPsHDOhmSjBon/4hCGZ6JxOoE=; b=03fUILDVhTOlebucJSzfbKIhBQKQYH4G/m9AJ+TyIuDM0dkg8vSIj466hRbjCCKg0S PhLxISaP1Dz7f/pNqy1xVvHTUFLdjmr+/djPJzDKLuBNsP75Kn24NUejQqgxfEBzid0G hCcEfAkywryD5atChE6edayq9dt3/+miQiVfqOT5TXKXHKt4tmSFYIytVBUQ/3ny5OpF vcQeNlfeGuhcEwujZfKL4M3LwAseGsCgc+T+N4S+PEKad5dy7N6KvypSvWNYVQQBDiqD w3igI7bPV8dZji/NbooUzucepgOYIDzOXG4ELvD/hC8IGXc4VkJ6Z6t5KDoIoIKpClnY Ud4Q== MIME-Version: 1.0 X-Received: by 10.13.209.4 with SMTP id t4mr32565326ywd.88.1440439304346; Mon, 24 Aug 2015 11:01:44 -0700 (PDT) Received: by 10.13.204.18 with HTTP; Mon, 24 Aug 2015 11:01:44 -0700 (PDT) In-Reply-To: References: Date: Mon, 24 Aug 2015 13:01:44 -0500 Message-ID: Subject: Re: Access control From: Clay Ferguson To: users@jackrabbit.apache.org Content-Type: multipart/alternative; boundary=001a114da74a0e6250051e1269b4 --001a114da74a0e6250051e1269b4 Content-Type: text/plain; charset=UTF-8 Hello Atif, You should check out my open source project: https://github.com/Clay-Ferguson/meta64 Download the zip and search for the words 'privilege' and/or AccessControl, etc. The AclService.java class has ability to do basic listing of privileges for a node, and adding or removing privileges from a node, and might help you some. Good luck. Best regards, Clay Ferguson wclayf@gmail.com On Mon, Aug 24, 2015 at 12:07 PM, Atif Manzoor wrote: > I am new to Jackrabbit and after going through the first hops and little > bit of documentation, I was trying to configure Access Control for the > repository nodes. I was extending ThirdHop tutorial for that purpose and > was following access control wiki > http://wiki.apache.org/jackrabbit/AccessControl and had the following > code. > > Session session = repository.login(new SimpleCredentials("username", > "password" > .toCharArray())); > Node node = session.getRootNode(); > String path = node.getPath(); > AccessControlManager acm = session.getAccessControlManager(); > > Privilege[] privileges = new Privilege[] { acm > .privilegeFromName(Privilege.JCR_ALL) }; > AccessControlList acl; > try { > acl = (AccessControlList) acm.getApplicablePolicies(path) > .nextAccessControlPolicy(); > } catch (NoSuchElementException e) { > acl = (AccessControlList) acm.getPolicies(path)[0]; > } > for (AccessControlEntry e : acl.getAccessControlEntries()) { > acl.removeAccessControlEntry(e); > } > acl.addAccessControlEntry(EveryonePrincipal.getInstance(), privileges); > acm.setPolicy(path, acl); > session.save(); > > My problem is that I could not get AccessControlList with this code. Both > functions (getApplicablePolicies and getAllPolicies) don't have any > AccessControlList attached with them. Can you tell me where I went wrong. I > have been using the default security configuration. > > Thanks > Atif > --001a114da74a0e6250051e1269b4--