Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions tabcmd/commands/user/user_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,13 @@ def to_tsc_user(self) -> TSC.UserItem:
"Unlicensed",
]

auth_types = ["Local", TSC.UserItem.Auth.SAML, TSC.UserItem.Auth.OpenID, TSC.UserItem.Auth.ServerDefault, "TableauId"]
auth_types = [
"Local",
TSC.UserItem.Auth.SAML,
TSC.UserItem.Auth.OpenID,
TSC.UserItem.Auth.ServerDefault,
TSC.UserItem.Auth.TableauIDWithMFA,
Copy link
Contributor

@anyoung-tableau anyoung-tableau Jul 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought site admins could turn MFA off for some users. TableauId no longer supported?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They can - I'm not sure how that works, but these are the only four Auth types in the server now.

]


# username, password, display_name, license, admin_level, publishing, email, auth type
Expand Down Expand Up @@ -116,9 +122,8 @@ def set_auth_arg(parser):
choices=auth_types,
type=case_insensitive_string_type(auth_types),
# default="TableauID", # default is Local for on-prem, TableauID for Online. Does the server apply the default?
help="Assigns the authentication type for all users in the CSV file. \
For Tableau Online, TYPE may be TableauID (default) or SAML. \
For Tableau Server, TYPE may be Local (default) or SAML.",
help="Assigns the authentication type for all users in the CSV file. Possible roles: "
+ ", ".join(auth_types),
)
return parser

Expand Down
20 changes: 20 additions & 0 deletions tests/parsers/test_parser_create_site_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,23 @@ def test_create_site_user_parser_role(self):
mock_args = [commandname, "users.csv", "--site", "site-name"]
args = self.parser_under_test.parse_args(mock_args)
assert args.site_name == "site-name", args

def test_create_site_user_parser_auth_Default(self):
with mock.patch("builtins.open", mock.mock_open(read_data="test")):
mock_args = [commandname, "users.csv", "--site", "site-name", "--auth-type", "ServerDefault"]
args = self.parser_under_test.parse_args(mock_args)
assert args.site_name == "site-name", args
assert args.auth_type == "ServerDefault", args

def test_create_site_user_parser_auth_MFA(self):
with mock.patch("builtins.open", mock.mock_open(read_data="test")):
mock_args = [commandname, "users.csv", "--site", "site-name", "--auth-type", "TableauIDWithMFA"]
args = self.parser_under_test.parse_args(mock_args)
assert args.site_name == "site-name", args
assert args.auth_type == "TableauIDWithMFA", args

def test_create_site_user_parser_auth_TabId_NotAvailable(self):
with mock.patch("builtins.open", mock.mock_open(read_data="test")):
mock_args = [commandname, "users.csv", "--site", "site-name", "--auth-type", "TableauId"]
with self.assertRaises(SystemExit):
args = self.parser_under_test.parse_args(mock_args)