Skip to content

Commit 0614dca

Browse files
committed
feat: add owner attribute to project
1 parent 4c09816 commit 0614dca

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tableauserverclient/models/project_item.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
from tableauserverclient.models.exceptions import UnpopulatedPropertyError
77
from tableauserverclient.models.property_decorators import property_is_enum
8+
from tableauserverclient.models.user_item import UserItem
89

910

1011
class ProjectItem:
@@ -44,6 +45,9 @@ class corresponds to the project resources you can access using the Tableau
4445
id : str
4546
The unique identifier for the project.
4647
48+
owner: Optional[UserItem]
49+
The UserItem owner of the project.
50+
4751
owner_id : str
4852
The unique identifier for the UserItem owner of the project.
4953
@@ -110,6 +114,8 @@ def __init__(
110114
self._view_count: Optional[int] = None
111115
self._datasource_count: Optional[int] = None
112116

117+
self._owner: Optional[UserItem] = None
118+
113119
@property
114120
def content_permissions(self):
115121
return self._content_permissions
@@ -223,6 +229,10 @@ def view_count(self) -> Optional[int]:
223229
def datasource_count(self) -> Optional[int]:
224230
return self._datasource_count
225231

232+
@property
233+
def owner(self) -> Optional[UserItem]:
234+
return self._owner
235+
226236
def is_default(self):
227237
return self.name.lower() == "default"
228238

@@ -240,6 +250,7 @@ def _set_values(
240250
workbok_count,
241251
view_count,
242252
datasource_count,
253+
owner,
243254
):
244255
if project_id is not None:
245256
self._id = project_id
@@ -265,6 +276,8 @@ def _set_values(
265276
self._top_level_project = top_level_project
266277
if writeable is not None:
267278
self._writeable = writeable
279+
if owner is not None:
280+
self._owner = owner
268281

269282
def _set_permissions(self, permissions):
270283
self._permissions = permissions
@@ -305,6 +318,7 @@ def _parse_element(project_xml: ET.Element, namespace: Optional[dict]) -> tuple:
305318
writeable = str_to_bool(project_xml.get("writeable", None))
306319
owner_id = None
307320
if (owner_elem := project_xml.find(".//t:owner", namespaces=namespace)) is not None:
321+
owner = UserItem.from_xml(owner_elem, namespace)
308322
owner_id = owner_elem.get("id", None)
309323

310324
project_count = None
@@ -330,6 +344,7 @@ def _parse_element(project_xml: ET.Element, namespace: Optional[dict]) -> tuple:
330344
workbok_count,
331345
view_count,
332346
datasource_count,
347+
owner,
333348
)
334349

335350

0 commit comments

Comments
 (0)