Skip to main content

Admin CLI

The admin command line tool, python -m scripts.workspace_admin, manages organizations, users, data backends and widget plugins from a terminal. The script is backend-api/backend/scripts/workspace_admin.py. It runs inside the API container and works on the database directly, so it sends no request to the API and needs no session. The tool is therefore the way to administer a deployment before anyone can sign in.

Commands belong to a noun, such as user or plugin, and each command has its own arguments. The option --json prints the outcome of a command as JSON. A command that cannot do what was asked prints the reason and exits with status 1.

The sections below list the commands of each noun with their arguments. The page is generated from the parser that the script builds, through backend-api/backend/reference-data/admin_cli.json, which the backend's exporter writes.

entity​

The entity commands manage organizations, which the tool calls entities.

python -m scripts.workspace_admin entity​

Manage organization entities

python -m scripts.workspace_admin entity create​

Create a new entity

Arguments

  • --jsonflagdefault false

    Print the outcome as JSON

  • --config, -cflagrequired

    Path to JSON config file with entity details

python -m scripts.workspace_admin entity list​

List all entities

Arguments

  • --jsonflagdefault false

    Print the outcome as JSON

  • --pageflagdefault 1

    Page number (default: 1)

  • --sizeflagdefault 100

    Items per page (default: 100)

  • --removedflagdefault false

    List the removed entities instead

python -m scripts.workspace_admin entity sample​

Print a sample entity config

python -m scripts.workspace_admin entity show​

Show details of a specific entity

Arguments

  • --jsonflagdefault false

    Print the outcome as JSON

  • entity_uuidargumentrequired

    UUID of the entity

python -m scripts.workspace_admin entity update​

Update an existing entity

Arguments

  • --jsonflagdefault false

    Print the outcome as JSON

  • entity_uuidargumentrequired

    UUID of the entity

  • --config, -cflag

    Path to JSON file containing fields to update

  • --data, -dflag

    JSON string with fields to update (e.g. '{"sharing_enabled": true}')

python -m scripts.workspace_admin entity delete​

Remove an entity that has no users; entity restore brings it back

Arguments

  • --jsonflagdefault false

    Print the outcome as JSON

  • entity_uuidargumentrequired

    UUID of the entity

python -m scripts.workspace_admin entity restore​

Restore a removed entity

Arguments

  • --jsonflagdefault false

    Print the outcome as JSON

  • entity_uuidargumentrequired

    UUID of the removed entity

  • --nameflag

    Name to give the entity (default: the name it had before)

user​

The user commands manage users.

python -m scripts.workspace_admin user​

Manage users within entities

python -m scripts.workspace_admin user create​

Create a user in an entity and print the link that sets their password

Arguments

  • --jsonflagdefault false

    Print the outcome as JSON

  • entity_uuidargumentrequired

    UUID of the target entity

  • --emailflagrequired

    User's email address

  • --first-nameflagrequired

    User's first name

  • --last-nameflagrequired

    User's last name

  • --role"admin" | "developer" | "user"default user

    User type (default: user)

python -m scripts.workspace_admin user list​

List users (globally or filtered)

Arguments

  • --jsonflagdefault false

    Print the outcome as JSON

  • --pageflagdefault 1

    Page number (default: 1)

  • --sizeflagdefault 100

    Items per page (default: 100)

  • --emailflag

    Only users whose email contains this

python -m scripts.workspace_admin user delete​

Remove a user from their entity

Arguments

  • --jsonflagdefault false

    Print the outcome as JSON

  • emailargumentrequired

    Email address of the user to remove

python -m scripts.workspace_admin user reset-password​

Reset a user's password and print the link that sets a new one

Arguments

  • --jsonflagdefault false

    Print the outcome as JSON

  • emailargumentrequired

    Email address of the user

python -m scripts.workspace_admin user move​

Move a user to another entity

Arguments

  • --jsonflagdefault false

    Print the outcome as JSON

  • --entity-uuidflagrequired

    UUID of the target entity

  • --emailflagrequired

    Email address of the user to move

  • --role"admin" | "developer" | "user"default user

    User type in the new entity (default: user)

data-backend​

The data-backend commands manage the data backends of an organization.

python -m scripts.workspace_admin data-backend​

Manage entity data backends

python -m scripts.workspace_admin data-backend add​

Add a data backend to an entity

Arguments

  • --jsonflagdefault false

    Print the outcome as JSON

  • entity_uuidargumentrequired

    UUID of the target entity

  • --nameflagrequired

    Name of the data backend

  • --urlflagrequired

    URL of the data backend

  • --headerflagrepeatable

    Endpoint header as key:value or key:value:location (repeatable)

python -m scripts.workspace_admin data-backend delete​

Remove a data backend from an entity

Arguments

  • --jsonflagdefault false

    Print the outcome as JSON

  • entity_uuidargumentrequired

    UUID of the target entity

  • --nameflagrequired

    Name of the data backend to remove

python -m scripts.workspace_admin data-backend list​

List data backends for an entity

Arguments

  • --jsonflagdefault false

    Print the outcome as JSON

  • entity_uuidargumentrequired

    UUID of the target entity

provision​

The provision commands set up an organization in bulk from one configuration file. A run creates the organization together with its administrators and its users. The commands check a file, apply it, and print a sample file.

python -m scripts.workspace_admin provision​

Bulk provisioning

python -m scripts.workspace_admin provision check​

Validate a provisioning config file

Arguments

  • --jsonflagdefault false

    Print the outcome as JSON

  • --config, -cflagrequired

    Path to JSON config file

python -m scripts.workspace_admin provision sample​

Print a sample provisioning config

python -m scripts.workspace_admin provision apply​

Create the entity, admins and users of a config

Arguments

  • --jsonflagdefault false

    Print the outcome as JSON

  • --config, -cflagrequired

    Path to JSON defining entity and users

plugin​

The plugin commands review and administer widget plugins. Plugin lifecycle and administration explains the workflow.

python -m scripts.workspace_admin plugin​

Review and enable widget plugins (packages are placed on the server, never installed from here)

python -m scripts.workspace_admin plugin list​

List discovered plugins and versions

Arguments

  • --jsonflagdefault false

    Print the outcome as JSON

python -m scripts.workspace_admin plugin rescan​

Read the plugins directory again

Arguments

  • --jsonflagdefault false

    Print the outcome as JSON

python -m scripts.workspace_admin plugin show​

Show a plugin: versions, what approving accepts, policy, organizations, events

Arguments

  • --jsonflagdefault false

    Print the outcome as JSON

  • plugin_idargumentrequired

    The plugin's id

python -m scripts.workspace_admin plugin approve​

Review a version and make it the active one

Arguments

  • --jsonflagdefault false

    Print the outcome as JSON

  • plugin_idargumentrequired

    The plugin's id

  • versionargumentrequired

    The version to approve

  • --acknowledgeflagdefault false

    Accept every added request the review lists (without it, only the review is shown)

  • --digestflag

    The version digest you checked with plugin_check; approval stops if the server's differs

python -m scripts.workspace_admin plugin revoke​

Stop a plugin everywhere (kill switch)

Arguments

  • --jsonflagdefault false

    Print the outcome as JSON

  • plugin_idargumentrequired

    The plugin's id

python -m scripts.workspace_admin plugin restore​

Undo a revoke

Arguments

  • --jsonflagdefault false

    Print the outcome as JSON

  • plugin_idargumentrequired

    The plugin's id

python -m scripts.workspace_admin plugin enable​

Enable the plugin for an organization, or for all

Arguments

  • --jsonflagdefault false

    Print the outcome as JSON

  • plugin_idargumentrequired

    The plugin's id

  • --entityflag

    UUID of the organization (entity)

  • --allflag

    Every organization

python -m scripts.workspace_admin plugin disable​

Disable the plugin for an organization, or for all

Arguments

  • --jsonflagdefault false

    Print the outcome as JSON

  • plugin_idargumentrequired

    The plugin's id

  • --entityflag

    UUID of the organization (entity)

  • --allflag

    Every organization

python -m scripts.workspace_admin plugin grant​

Grant a role a plugin's widgets: roles are the only way to a plugin

Arguments

  • --jsonflagdefault false

    Print the outcome as JSON

  • plugin_idargumentrequired

    The plugin's id

  • --roleflagrequired

    UUID of the role

  • --widgetflagdefault *

    One widget id (default: every widget)

python -m scripts.workspace_admin plugin ungrant​

Take a grant away from a role

Arguments

  • --jsonflagdefault false

    Print the outcome as JSON

  • plugin_idargumentrequired

    The plugin's id

  • --roleflagrequired

    UUID of the role

  • --widgetflagdefault *

    One widget id (default: every widget)

python -m scripts.workspace_admin plugin override​

Replace the superuser's overrides: the CSP by directive and the server network

Arguments

  • --jsonflagdefault false

    Print the outcome as JSON

  • plugin_idargumentrequired

    The plugin's id

  • --csp-fileflag

    JSON file of directive to sources, e.g. {"connect-src": ["https://<host>"]}

  • --server-networkflagrepeatable

    An https origin the server may call for the plugin's proxies, replacing the hosts it declares (repeatable)

  • --clearflagdefault false

    Remove the overrides

  • --confirm"insecure-scheme" | "private-host" | "remote-script"repeatable

    Confirm a dangerous source the overrides add (repeatable); private-host with --server-network also lets those hosts resolve to private addresses

python -m scripts.workspace_admin plugin secret​

Set or clear the value of a secret the plugin declares

python -m scripts.workspace_admin plugin secret set​

Set the value: read without echo, or from standard input, never an argument

Arguments

  • --jsonflagdefault false

    Print the outcome as JSON

  • plugin_idargumentrequired

    The plugin's id

  • nameargumentrequired

    The secret's name, as the plugin declares it

python -m scripts.workspace_admin plugin secret clear​

Remove the value a superuser set

Arguments

  • --jsonflagdefault false

    Print the outcome as JSON

  • plugin_idargumentrequired

    The plugin's id

  • nameargumentrequired

    The secret's name, as the plugin declares it

python -m scripts.workspace_admin plugin check-backend​

Ask the plugin's backend for its identity now (the deployer runs and lists it)

Arguments

  • --jsonflagdefault false

    Print the outcome as JSON

  • plugin_idargumentrequired

    The plugin's id

python -m scripts.workspace_admin plugin events​

List the plugin's events

Arguments

  • --jsonflagdefault false

    Print the outcome as JSON

  • plugin_idargumentrequired

    The plugin's id

python -m scripts.workspace_admin plugin reports​

List requests the plugin's policy blocked

Arguments

  • --jsonflagdefault false

    Print the outcome as JSON

  • plugin_idargumentrequired

    The plugin's id

python -m scripts.workspace_admin plugin forget​

Forget a plugin whose files are gone, with its decisions, grants and secrets

Arguments

  • --jsonflagdefault false

    Print the outcome as JSON

  • plugin_idargumentrequired

    The plugin's id