uggh, sorry I just realized my bug... never mind

On Thu, May 24, 2012 at 3:31 PM, waynesj <[email protected]> wrote:

> Hi
>    I'm delving into zookeeper and trying to wrap my head around ACL
> access. As I understand from reading the ACL section of the programing
> guide, I s/b able to create a znode with a set  ACLs that I can partition
> access to znode with?  I'm able to create the node with an set of ACL's and
> verified that the ACL's were part of the new node.
>
> However when I try to read the znode using a client auth with read ACL it
> always returns AUTH fail? I running 3.4.3 standalone, below is sample code
> I was using. Did I misunderstood usage or miss something?
> Thanks in advance!
> Wayne
>
> ...
> ZooKeeper zooKeeper = new ZooKeeper(HOSTPORT, 300, this);
> zooKeeper.addAuthInfo("digest", "me:pass".getBytes());
>
> List <ACL> aclLst = new ArrayList<ACL>();
>
> Id id = new Id();
> id.setId("someone:else");
> id.setScheme("digest");
> aclLst.add(new ACL( ZooDefs.Perms.READ, id));
> zooKeeper.close();
>
> ZooKeeper ownerRead = new ZooKeeper(HOSTPORT, 300, this);
> ownerRead.addAuthInfo("digest", "me:pass".getBytes());
> Stat nodeStat = new Stat();
> byte[] nodeData = ownerRead.getData("/test", false, nodeStat); //
> CREATOR_ALL_ACL works fine
> ownerRead.close();
>
> ZooKeeper authRead = new ZooKeeper(HOSTPORT, 300, this);
> authRead.addAuthInfo("digest", "someone:else".getBytes());
> try {
>      byte[] nodeData = authRead.getData("/test", false, nodeStat);
>  } catch(Exception exc) {
>       Assert.fail("authRead should be allowed??");  // always fails
>  }
>  authRead.close();
>
>

Reply via email to