Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(async () => {
try {
const loginReq: Parameters.Login = { user: IMMUDB_USER, password: IMMUDB_PWD }
const loginRes = await cl.login(loginReq)
console.log('success: login', loginRes)
const createUserReq: Parameters.CreateUser = {
user: randStr,
password: 'Example12#',
permission: USER_PERMISSION.READ_ONLY,
database: 'defaultdb',
}
const createUserRes = await cl.createUser(createUserReq)
console.log('success: createUser', createUserRes);
const listUsersRes = await cl.listUsers()
console.log('success: listUser', util.inspect(listUsersRes, false, 6, true))
const changePermissionReq: Parameters.ChangePermission = {
action: USER_ACTION.GRANT,
username: randStr,
database: randStr,
permission: USER_PERMISSION.READ_WRITE,
}
const changePermissionRes = await cl.changePermission(changePermissionReq)
console.log('success: changePermission', changePermissionRes);