User management

This page describes how to create new users in self-hosted or on-prem deployments of Databand.

Overview

User creation is possible from the dbnd-web container, where direct access to the database is available.

$ dbnd-web db user-create --help
...
Usage: dbnd-web db user-create [OPTIONS]

  Create a new databand and web server user

Options:
  -r, --role TEXT        [required]
  -u, --username TEXT    [required]
  -e, --email TEXT       [required]
  -f, --firstname TEXT   [required]
  -l, --lastname TEXT    [required]
  -p, --password TEXT    NOTE: This argument is mutually exclusive with
                         use_random_password
  --use-random-password
  --only-if-empty
  --skip-existing
  --update-existing
  --help                 Show this message and exit.

Roles

There are two roles defined: Admin and DefaultUser.
Admin users have access to the Admin UI. No other privileges are available.

Other options

  • --only-if-empty - skip user creation if database contains other users. Useful for env provisioning.
  • --skip-existing and --update-existing - skip or update if a user with the same username already exists in the database.
  • --use-random-password - create a user with an unknown password. Might be used to create service users, it's expected to be used in conjunction with dbnd-web webserver create-personal-access-token -u user -p any (-p any might be used if no advanced auth with Keycloak configured).

Usage Examples

# Admin user
$ dbnd-web db user-create -r Admin -u admin -e [email protected] -f admin -l admin -p password
...
INFO  main            - DefaultUser user 'user' created.

# Default user
$ dbnd-web db user-create -r DefaultUser -u user -e [email protected] -f user -l user -p password
...
INFO  main            - DefaultUser user 'user' created.

Docker-compose

$ docker-compose exec webserver 
[email protected]:/dbnd# dbnd-web db user-create ...

Helm

$ export NAMESPACE=<your namespace>
$ kubectl get pods --selector=component=web --namespace $NAMESPACE
NAME                                         READY   STATUS    RESTARTS   AGE
databand-demo-develop-web-594785d557-7n8wm   1/1     Running   0          6h54m
databand-demo-develop-web-594785d557-9sht9   1/1     Running   0          6h57m
$ kubectl exec -it databand-demo-develop-web-594785d557-7n8wm --namespace $NAMESPACE -- bash
[email protected]:/dbnd# dbnd-web db user-create ...

Admin UI

It's also possible to create/edit/delete users in Admin UI.
Navigate to /admin/user/ as a user with Admin role.

SQL

List Users SQL query:

SELECT ab_user.*, ab_role.name as role
FROM ab_user
JOIN ab_user_role ON ab_user_role.user_id = ab_user.id
JOIN ab_role ON ab_user_role.role_id = ab_role.id

Expected output:


Did this page help you?