-
Notifications
You must be signed in to change notification settings - Fork 111
/
acl.js
39 lines (28 loc) · 1022 Bytes
/
acl.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const { getClient, constants } = require('./wrapper');
const logger = require('./logger');
const notifier = require('./notifier');
notifier.on('connect', (message) => logger.log('connect', message));
notifier.on('createNode', (message) => logger.log('createNode', message));
async function init() {
const client = getClient();
client.on('connect', async () => {
const path = '/acl-testing';
const data = '';
const flags = constants.ZOO_EPHEMERAL;
const version = 0;
await client.create(path, data, flags);
const before = await client.get_acl(path);
const updatedAcl = [{
perm: constants.ZOO_PERM_READ,
scheme: 'world',
auth: 'anyone',
}];
await client.set_acl(path, version, updatedAcl);
const after = await client.get_acl(path);
logger.log('before:', before[0]);
logger.log('after:', after[0]);
});
}
if (require.main === module) {
init().catch(logger.error);
}