Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function main(err, cl) {
if (err) {
return console.log(err)
}
try {
let req = { username: IMMUDB_USER, password: IMMUDB_PWD }
let res = await cl.login(req)
console.log('success: login', res)
req = {
username: rand,
password: 'Example12#',
permission: types.permission.readWrite,
database: 'defaultdb',
}
res = await cl.createUser(req)
console.log('success: createUser');
res = await cl.listUsers()
console.log('success: listUser', util.inspect(res, false, 6, true))
req = {
action: types.action.grant,
username: rand,
database: rand,
permission: types.permission.readOnly,
}
res = await cl.changePermission(req)
console.log('success: changePermission');
username: rand,
password: 'Example12#',
permission: types.permission.readWrite,
database: 'defaultdb',
}
res = await cl.createUser(req)
console.log('success: createUser');
res = await cl.listUsers()
console.log('success: listUser', util.inspect(res, false, 6, true))
req = {
action: types.action.grant,
username: rand,
database: rand,
permission: types.permission.readOnly,
}
res = await cl.changePermission(req)
console.log('success: changePermission');
req = {
username: rand,
old: 'Example12#',
new: 'Example1234%',
}
res = await cl.changePassword(req)
console.log('success: changePassword');
req = {
username: rand,
active: true,
}