How to use the immudb-node/dist/types/user.USER_PERMISSION.READ_WRITE 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.ts View on Github external
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);

    const changePasswordReq: Parameters.ChangePassword = {
      user: randStr,
      oldpassword: 'Example12#',
      newpassword: 'Example1234%',
    }
    const changePasswordRes = await cl.changePassword(changePasswordReq)
    console.log('success: changePassword', changePasswordRes);

    const setActiveUserReq: Parameters.SetActiveUser = {
      username: randStr,
      active: true,
    }