Team Operations
  • 14 Jul 2023
  • 2 Minutes to read
  • Dark
    Light

Team Operations

  • Dark
    Light

Article Summary

API Requirement

You need to have access to the Preset API in order to successfully use the Preset CLI.

Export users

You can use the CLI to generate a YAML report of existing users, containing name, username, email and roles. This file can then be used to import these users in your Preset team.

To generate a user report from Superset:

superset-cli $https://superseturl.com export-users $/path/to/yaml/file

Replace:

  • $https://suerseturl.com with the actual link to the Superset application
  • $/path/to/yaml/file with the path the file should be downloaded to.

To generate the report from Preset Cloud:

superset-cli export-users --teams=$team_slug $/path/to/yaml/file

Replace:

  • $/path/to/yaml/file with the path the file should be downloaded to.
  • $team_slug with your Team Slug. If you don't pass this command, the CLI will prompt you with list of teams to choose.

This is the structure of the generated YAML file:

- email: user_email@test_email.com
  first_name: First
  last_name: Name
  role:
  - Admin
  - Gama
  username: username

Import users (Preset Cloud only)

Once you have the YAML file generated by the Export users command, you can use the Import users command to provision them to your Preset team:

preset-cli import-users --teams=$team_slug $/path/to/yaml/file

Replace:

  • $team_slug with your Team Slug. If you don't pass this command, the CLI will prompt you with list of teams to choose.
  • $/path/to/yaml/file with the path to the YAML file containing the information for the users to be provisioned.

Note that provisioned users through this command are automatically added to your team (no need to accept an invitation).

Invite users (Preset Cloud only)

Alternatively, you can use the CLI to invite users in bulk to your Preset team. Invited users need to accept the invitation to properly join your Preset team. Example command:

preset-cli invite-users --teams=$team_slug $/path/to/yaml/file

Replace:

  • $team_slug with your Team Slug. If you don't pass this command, the CLI will prompt you with list of teams to choose.
  • $/path/to/yaml/file with the path to the YAML file containing the user emails.

The YAML generated by the Export users command is also compatible with this flow (it basically needs email information:

- email: user_email@test_domain.com
- email: second_user_email@test_domain.com

List SCIM group memberships

You can also use the CLI to view and generate a report of team groups and their membership created through SCIM.

preset-cli list-group-membership --teams=$team_slug 

Replace: $team_slug with your Team Slug. If you don't pass this command, the CLI will prompt you with list of teams to choose.

By default, the report will be displayed in the terminal, which might not be optimal depending on the amount of groups and users added to the team. You can include the --save-report flag to save the report to a file, instead. The file would be saved in the current terminal location.

Available options:

  • --save-report=csv to generate a CSV report. Column structure:
Group Name,Group ID,User,Username
  • --save-report=yaml to generate a YAML report. YAML structure:
Resources:
- displayName: Group Name
  id: Group ID
  members:
  - display: User Name
    value: username
  meta:
    resourceType: Group
  schemas:
  - urn:ietf:params:scim:schemas:core:2.0:Group

Was this article helpful?