Groups¶
The following methods allow for interaction into the Tenable Vulnerability Management groups API.
Methods available on tio.groups:
- class GroupsAPI(api: APISession)[source]¶
- add_user(group_id, user_id)[source]¶
Add a user to a user group.
- Parameters:
- Returns:
The user was successfully added to the group.
- Return type:
Examples
>>> tio.groups.add_user(1, 1)
- create(name, *, managed_by_saml=None)[source]¶
Create a new user group.
- Parameters:
- Returns:
The group resource record of the newly minted group. It includes
managed_by_samlonly if the flag was set.- Return type:
Examples
>>> group = tio.groups.create('Group Name')
Create a group whose membership SAML manages:
>>> group = tio.groups.create('SAML Admins', managed_by_saml=True)
- delete(id)[source]¶
Delete a user group.
- Parameters:
id (int) – The unique identifier for the group to be deleted.
- Returns:
The group was successfully deleted.
- Return type:
Examples
>>> tio.groups.delete(1)
- delete_user(group_id, user_id)[source]¶
Delete a user from a user group.
- Parameters:
- Returns:
The user was successfully removed from the group.
- Return type:
Examples
>>> tio.groups.delete_user(1, 1)
- edit(id, name, *, managed_by_saml=None)[source]¶
Edit a user group.
- Parameters:
id (int) – The unique identifier for the group to be modified.
name (str) – The new name for the group. The API requires a name on every edit, so pass the current name to change only
managed_by_saml.managed_by_saml (bool, optional) – If
True, SAML single sign-on can add users to and remove users from the group. IfFalse, group membership is managed independently of SAML. If omitted, the current setting is kept.
- Returns:
The group resource record.
- Return type:
Examples
>>> tio.groups.edit(1, 'Updated name')
Stop SAML from managing the group’s membership:
>>> tio.groups.edit(1, 'SAML Admins', managed_by_saml=False)
- list()[source]¶
Lists all of the available user groups.
- Returns:
List of the group resource records
- Return type:
Examples
>>> for group in tio.groups.list(): ... pprint(group)
- list_users(id)[source]¶
List the user memberships within a specific user group.
- Parameters:
id (int) – The unique identifier of the group requested.
- Returns:
List of user resource records based on membership to the specified group.
- Return type:
Example
>>> for user in tio.groups.list_users(1): ... pprint(user)