How to use the immudb-node/lib/types.permission function in immudb-node

To help you get started, we’ve selected a few immudb-node examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github codenotary / immudb-client-examples / node / user-management.js View on Github external
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');
github codenotary / immudb-client-examples / node / user-management.js View on Github external
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,
    }