Provision an organization from a file
This guide creates a whole organization in one step: the organization itself, its administrators and its users, from a JSON file. It suits a deployment that serves several organizations, and a rollout that starts with a list of people. You need access to the admin command line tool, which runs inside the API's container and works on the database directly, as Admin command line describes. You do not need a session of the web app.
Write the file
The file is a JSON object with three parts. The part entity describes the organization. It has a name and an admin_email, the address of the primary administrator, which are required, and it may have sharing_enabled, which is true unless you say otherwise and which decides whether the organization's roles may allow sharing dashboards and apps. The part admins lists the administrators, and the part users lists the other people. Each person has an email, a first_name and a last_name. Ask the tool for a sample, so that you start from the exact shape:
python -m scripts.workspace_admin provision sample
A file for an organization called Northwind Research with one administrator and two users looks like this:
{
"entity": {
"name": "Northwind Research",
"sharing_enabled": true,
"admin_email": "admin@northwind.example"
},
"admins": [
{ "email": "admin@northwind.example", "first_name": "Ada", "last_name": "Admin" }
],
"users": [
{ "email": "ana@northwind.example", "first_name": "Ana", "last_name": "Analyst" },
{ "email": "bo@northwind.example", "first_name": "Bo", "last_name": "Banker" }
]
}
Check the file
Put the file where the API's container can read it, and check it:
python -m scripts.workspace_admin provision check --config provision.json
The tool prints "Configuration is valid" when the file is complete. Otherwise it lists each problem and changes nothing, for example "Entity missing required field: admin_email" and "User (users #0) missing field: first_name".
Apply the file
python -m scripts.workspace_admin provision apply --config provision.json
The tool creates the organization and then each administrator and user, and it prints a line for each. Every account gets a link that sets its password. The tool prints the link once: copy it and give it to the person, because FINOS Workspace sends no email. The link works once and expires after 24 hours, and the line shows the exact time. When the person opens it, they choose their own password, so you never learn it.
Each new account starts with the role Agent User of its organization, which grants the Agent's default models and tools, and administrators have the type Admin and everyone else the type User. To change a person's type or role afterwards, use the admin area, as Add a user and Create a role describe.
Run it twice, and add people later
The tool creates an organization, and it refuses to create one that already exists. A second run with the same name stops with "An entity with this name already exists". To add people to an organization that exists, use user create with the organization's id, which entity list prints, or add them in the admin area, or import a file of addresses, as Add a user describes.
python -m scripts.workspace_admin entity list
python -m scripts.workspace_admin user create <entity-uuid> --email <email> --first-name <name> --last-name <name> --role developer
The option --role takes admin, developer or user, and user is the default. The command prints the link that sets the person's password.
Where to go next
Sign in as the administrator of the new organization and give its roles access to data, as Give a role access to data describes. A superuser can move people between organizations later, as Manage organizations describes.