Skip to content

feat: add --idp-configuration-id flag for multi-IDP Tableau Cloud sites - #444

Open
jacalata wants to merge 1 commit into
developmentfrom
jac/393-multi-idp-support
Open

feat: add --idp-configuration-id flag for multi-IDP Tableau Cloud sites#444
jacalata wants to merge 1 commit into
developmentfrom
jac/393-multi-idp-support

Conversation

@jacalata

Copy link
Copy Markdown
Contributor

Closes #393.

Summary

Tableau Cloud 2024.3+ supports up to 20 identity providers per site, and the REST API takes an idpConfigurationId attribute when creating users. Neither createsiteusers nor createUsers previously exposed the field, so operators on multi-IDP sites had to bypass tabcmd and script the REST API directly.

Adds --idp-configuration-id UUID to both createsiteusers and createUsers. The flag applies to every user in the batch. Argparse's add_mutually_exclusive_group enforces that --auth-type and --idp-configuration-id cannot both be passed, matching the REST API's own constraint (TSC's create_req raises if both attributes are set).

Scope decisions

  • CSV format unchanged. The existing 8-column CSV is a shared cross-tool convention (Server web-UI user-import, tabcmd 1, tabcmd 2). Adding a 9th column here alone would create format divergence; that's better handled as a coordinated cross-tool update if per-user IDP assignment turns out to be needed.
  • Batch-level assignment only in this PR. Real multi-IDP customers typically assign a batch of users to one IDP per run; a per-user 9th column can follow if there's demand.
  • Refactor: the per-user --role / --auth-type / --idp-configuration-id application was duplicated between the two commands. Lifted into UserCommand.apply_cli_overrides so the branch is defined and tested in one place.

Test plan

  • pytest tests/ — 347 passed, 2 skipped, 0 failed
  • 6 new tests:
    • Parser: valid parse + mutual exclusion, on each of createsiteusers and createUsers (4 tests)
    • apply_cli_overrides: IDP flag clears a pre-existing auth_setting (covers the CSV col 8 + --idp-configuration-id interaction); role flag applied (2 tests)
  • check-strings — SUCCESS, all i18n keys defined
  • black --check — clean (using pinned black>=22,<23)
  • mypy tabcmd/commands/user/ — 0 new errors
  • tabcmd createsiteusers --auth-type SAML --idp-configuration-id x users.csv → argparse rejects with "not allowed with argument --auth-type" (confirmed at CLI)

Follow-ups (not in this PR)

  • Per-user IDP assignment via a 9th CSV column would need to land coordinated with tabcmd 1 and the Server web-UI import to avoid format divergence.
  • Docs on help.tableau.com should mention the new flag alongside the existing --auth-type doc for createsiteusers / createUsers.

🤖 Generated with Claude Code

Tableau Cloud 2024.3+ supports up to 20 identity providers per site, and
the REST API takes an idpConfigurationId attribute when creating users.
Neither `createsiteusers` nor `createUsers` previously exposed the field,
so operators on multi-IDP sites had to bypass tabcmd and script the REST
API directly.

Adds `--idp-configuration-id UUID` to both commands. The flag applies to
every user in the batch. Argparse's add_mutually_exclusive_group enforces
that --auth-type and --idp-configuration-id cannot both be passed (TSC's
create_req rejects that combination on the wire).

The CSV format is unchanged (still 8 columns) so it stays consistent with
Tableau Server's web-UI user-import and tabcmd 1. Per-user IDP assignment
via a 9th CSV column was considered and deferred; it would require a
coordinated cross-tool format update.

While here, extracts the per-user `--role`/`--auth-type`/`--idp-configuration-id`
application into UserCommand.apply_cli_overrides, removing the block
duplicated between the two commands, and drops an unused
tableauserverclient import from create_users_command.py.

Adds 6 new tests: 4 for the parser (both commands, valid parse + mutual
exclusion), 2 for apply_cli_overrides (IDP clears pre-existing
auth_setting, role flag applied). All 347 tests pass.

Closes #393

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Coverage

Coverage Report
FileStmtsMissCoverMissing
tabcmd
   __main__.py121212 0%
   _version.py111111 0%
   tabcmd.py151515 0%
   version.py955 44%
tabcmd/commands
   commands.py101010 0%
   constants.py772424 69%
   server.py1351818 87%
tabcmd/commands/auth
   session.py3945050 87%
tabcmd/commands/datasources_and_workbooks
   datasources_and_workbooks_command.py1571818 89%
   datasources_workbooks_views_url_parser.py14255 96%
   delete_command.py601616 73%
   export_command.py1202525 79%
   get_url_command.py1274747 63%
   publish_command.py1232828 77%
   runschedule_command.py2177 67%
tabcmd/commands/extracts
   create_extracts_command.py4288 81%
   decrypt_extracts_command.py2722 93%
   delete_extracts_command.py3766 84%
   encrypt_extracts_command.py2722 93%
   extracts.py2022 90%
   reencrypt_extracts_command.py2722 93%
   refresh_extracts_command.py481010 79%
tabcmd/commands/group
   create_group_command.py2955 83%
   delete_group_command.py2722 93%
tabcmd/commands/project
   create_project_command.py4688 83%
   delete_project_command.py3544 89%
   publish_samples_command.py3044 87%
tabcmd/commands/site
   create_site_command.py3455 85%
   delete_site_command.py2722 93%
   edit_site_command.py3822 95%
   list_command.py771212 84%
   list_sites_command.py2922 93%
tabcmd/commands/user
   add_users_command.py2955 83%
   create_site_users.py551111 80%
   create_users_command.py551010 82%
   delete_site_users_command.py4355 88%
   user_data.py2333131 87%
tabcmd/execution
   _version.py222 0%
   global_options.py12588 94%
   localize.py661111 83%
   logger_config.py6066 90%
   tabcmd_controller.py4277 83%
TOTAL287746584% 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant