-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add example code for ACL #194
Comments
I would like to work on it |
@DavidVujic is set_acl working for you? After setting acl I can no longer access the node. Something wrong with set_acl? |
@maharjanraj It looks like the doc-strings for the I will update the docs (and add a runnable example). Thank you for reporting! Working example: client.on('connect', async () => {
const path = "/acl-testing";
const data = "";
const flags = constants.ZOO_EPHEMERAL;
await client.create(path, data, flags);
const [aclBefore, statBefore] = await client.get_acl(path);
updatedAcl = [{
perm: constants.ZOO_PERM_READ | constants.ZOO_PERM_WRITE,
scheme: "world",
auth: "anyone",
}];
await client.set_acl(path, 0, updatedAcl);
const [aclAfter, statAfter] = await client.get_acl(path);
console.log("before:", aclBefore);
console.log("after:", aclAfter);
}); The output: before: [ { perms: 31, scheme: 'world', auth: 'anyone' } ]
after: [ { perms: 3, scheme: 'world', auth: 'anyone' } ] |
There's a new version out: 6.2.1. This version has the correct typing for the ACL. Have a look at the added runnable example for setting the ACL on a ZooKeeper node. You will find it in the |
@DavidVujic thanks for quickly answering and helping out. As you said, using perm instead of perms worked. Are you going to change perm to perms? |
Great! Happy to hear that it worked. As for now, I'll keep |
Is your feature request related to a problem? Please describe.
There should be a working runnable code example for using the ACL feature of the library. Example code exist in the README, but that one is not longer valid (the API was probably different at the time of writing). The current example will be removed from the README shortly.
Describe the solution you'd like
A JavaScript file with ACL example code, in the
examples
folder. The code should use the Promise based ZooKeeper client. This file should be able to run usingnode examples/acl.js
.Additional context
This is the example code (that is not currently working) from the README:
The text was updated successfully, but these errors were encountered: