8000 Add documentation for getting user groups (#800) · shiv-io/server-client-python@edc11f2 · GitHub
[go: up one dir, main page]

Skip to content 8000

Commit edc11f2

Browse files
authored
Add documentation for getting user groups (tableau#800)
1 parent f3bb202 commit edc11f2

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

docs/api-ref.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2855,6 +2855,7 @@ Name | Description
28552855
`fullname` | The full name of the user.
28562856
`name` | The name of the user. This attribute is required when you are creating a `UserItem` instance.
28572857
`site_role` | The role the user has on the site. This attribute is required with you are creating a `UserItem` instance. The specific roles vary depending upon the version of the REST API. For example, for version 2.8 and earlier, the `site_role` can be one of the following: `Interactor`, `Publisher`, `ServerAdministrator`, `SiteAdministrator`, `Unlicensed`, `UnlicensedWithPublish`, `Viewer`, `ViewerWithPublish`, `Guest`. For REST API 3.0 and later, the `site_role` can be one of the following `Creator`, `Explorer`, `ExplorerCanPublish`, `ReadOnly` *(viewers from previous API versions who do not have v3.0+ viewer permissions)*, `Viewer`, `SiteAdministratorCreator`, `SiteAdministratorExplorer`, `UnlicensedWithPublish`.
2858+
`groups` | The groups that the user belongs to. You must run the populate_groups method to add the groups to the `UserItem`.
28582859

28592860

28602861
**Example**
@@ -3024,6 +3025,58 @@ Returns the list of favorites (views, workbooks, and data sources) for a user.
30243025
<br>
30253026
<br>
30263027

3028+
#### users.populate_groups
3029+
3030+
```py
3031+
users.populate_groups(user_item, req_options=None):
3032+
```
3033+
3034+
Returns the groups that the user belongs to.
3035+
3036+
**Parameters**
3037+
3038+
Name | Description
3039+
:--- | : ---
3040+
`user_item` | The `user_item` specifies the user to populate with group membership.
3041+
3042+
3043+
3044+
3045+
**Exceptions**
3046+
3047+
Error | Description
3048+
:--- | : ---
3049+
`User item missing ID.` | Raises an error if the `user_item` is unspecified.
3050+
3051+
3052+
**Returns**
3053+
3054+
A list of `GroupItem`
3055+
3056+
A `PaginationItem` that points (`user_item.groups`). See [UserItem class](#useritem-class)
3057+
3058+
3059+
**Example**
3060+
3061+
```py
3062+
# first get all users, call server.users.get()
3063+
# get groups for user[0]
3064+
...
3065+
3066+
page_n = server.users.populate_groups(all_users[0])
3067+
print("\nUser {0} is a member of {1} groups".format(all_users[0].name, page_n.total_available))
3068+
print("\nThe groups are:")
3069+
for group in all_users[0].groups :
3070+
print(group.name)
3071+
3072+
...
3073+
```
3074+
3075+
3076+
3077+
3078+
<br>
3079+
<br>
30273080

30283081
#### users.populate_workbooks
30293082

0 commit comments

Comments
 (0)
0