77from defusedxml .ElementTree import fromstring
88
99from tableauserverclient .datetime_helpers import parse_datetime
10+ from tableauserverclient .models .site_item import SiteAuthConfiguration
1011from .exceptions import UnpopulatedPropertyError
1112from .property_decorators import (
1213 property_is_enum ,
@@ -94,6 +95,7 @@ def __init__(
9495 self .name : Optional [str ] = name
9596 self .site_role : Optional [str ] = site_role
9697 self .auth_setting : Optional [str ] = auth_setting
98+ self ._idp_configuration_id : Optional [str ] = None
9799
98100 return None
99101
@@ -184,6 +186,18 @@ def groups(self) -> "Pager":
184186 raise UnpopulatedPropertyError (error )
185187 return self ._groups ()
186188
189+ @property
190+ def idp_configuration_id (self ) -> Optional [str ]:
191+ """
192+ IDP configuration id for the user. This is only available on Tableau
193+ Cloud, 3.24 or later
194+ """
195+ return self ._idp_configuration_id
196+
197+ @idp_configuration_id .setter
198+ def idp_configuration_id (self , value : str ) -> None :
199+ self ._idp_configuration_id = value
200+
187201 def _set_workbooks (self , workbooks ) -> None :
188202 self ._workbooks = workbooks
189203
@@ -204,8 +218,9 @@ def _parse_common_tags(self, user_xml, ns) -> "UserItem":
204218 email ,
205219 auth_setting ,
206220 _ ,
221+ _ ,
207222 ) = self ._parse_element (user_xml , ns )
208- self ._set_values (None , None , site_role , None , None , fullname , email , auth_setting , None )
223+ self ._set_values (None , None , site_role , None , None , fullname , email , auth_setting , None , None )
209224 return self
210225
211226 def _set_values (
@@ -219,6 +234,7 @@ def _set_values(
219234 email ,
220235 auth_setting ,
221236 domain_name ,
237+ idp_configuration_id ,
222238 ):
223239 if id is not None :
224240 self ._id = id
@@ -238,6 +254,8 @@ def _set_values(
238254 self ._auth_setting = auth_setting
239255 if domain_name :
240256 self ._domain_name = domain_name
257+ if idp_configuration_id :
258+ self ._idp_configuration_id = idp_configuration_id
241259
242260 @classmethod
243261 def from_response (cls , resp , ns ) -> list ["UserItem" ]:
@@ -265,6 +283,7 @@ def _parse_xml(cls, element_name, resp, ns):
265283 email ,
266284 auth_setting ,
267285 domain_name ,
286+ idp_configuration_id ,
268287 ) = cls ._parse_element (user_xml , ns )
269288 user_item = cls (name , site_role )
270289 user_item ._set_values (
@@ -277,6 +296,7 @@ def _parse_xml(cls, element_name, resp, ns):
277296 email ,
278297 auth_setting ,
279298 domain_name ,
299+ idp_configuration_id ,
280300 )
281301 all_user_items .append (user_item )
282302 return all_user_items
@@ -295,6 +315,7 @@ def _parse_element(user_xml, ns):
295315 fullname = user_xml .get ("fullName" , None )
296316 email = user_xml .get ("email" , None )
297317 auth_setting = user_xml .get ("authSetting" , None )
318+ idp_configuration_id = user_xml .get ("idpConfigurationId" , None )
298319
299320 domain_name = None
300321 domain_elem = user_xml .find (".//t:domain" , namespaces = ns )
@@ -311,6 +332,7 @@ def _parse_element(user_xml, ns):
311332 email ,
312333 auth_setting ,
313334 domain_name ,
335+ idp_configuration_id ,
314336 )
315337
316338 class CSVImport :
@@ -361,6 +383,7 @@ def create_user_from_line(line: str):
361383 values [UserItem .CSVImport .ColumnType .EMAIL ],
362384 values [UserItem .CSVImport .ColumnType .AUTH ],
363385 None ,
386+ None ,
364387 )
365388 return user
366389
0 commit comments