Users

Methods described in this section relate to the users API. These methods can be accessed at TenableAD.users.

class UsersAPI(api: restfly.session.APISession)[source]
change_password(old_password: str, new_password: str) None[source]

Update a user password

Parameters
  • old_password (str) – old password of user.

  • new_password (str) – new password of user.

Return type

None

Examples

>>> tad.users.change_password(
...     old_password='old_password',
...     new_password='new_password'
...     )
create(name: str, email: str, password: str, **kwargs) List[Dict][source]

Create users

Parameters
  • name (str) – The name of new user.

  • email (str) – The email address of the user.

  • password (str) – The password for the new user.

  • surname (optional, str) – The surname of new user.

  • department (optional, str) – The department of user.

  • biography (optional, str) – The biography of user.

  • active (optional, bool) – is the user active?

  • picture (optional, List[int]) – The list of picture numbers

Returns

The created user objects

Return type

list[dict]

Example

>>> tad.users.create(
...     name='username',
...     email='test@domain.com',
...     password='user_password',
...     active=True
...     )
create_password(email: str) None[source]

Sends an email to create new password

Parameters

email (str) – The email address of the user.

Return type

None

Examples

>>> tad.users.create_password(email='test@domain.com')
delete(user_id: str) None[source]

Delete an existing user

Parameters

user_id (str) – The user instance identifier.

Return type

None

Examples

>>> tad.users.delete(user_id='1')
details(user_id: str) Dict[source]

Retrieves the details for a specific user

Parameters

user_id (str) – The user instance identifier.

Returns

the user object.

Return type

dict

Examples

>>> tad.users.details('1')
info() Dict[source]

Gets user information

Returns

The user info object

Return type

dict

Example

>>> tad.users.info()
list() List[Dict][source]

Retrieve all users

Returns

The list of users objects

Return type

list

Examples

>>> tad.users.list()
retrieve_password(token: str, new_password: str) None[source]

Retrieves a user password

Parameters
  • token (str) – user token.

  • new_password (str) – new password for user.

Return type

None

Examples

>>> tad.users.retrieve_password(
...     token='token',
...     new_password='new_password'
...     )
update(user_id: str, **kwargs) Dict[source]

Update an existing user

Parameters
  • user_id (str) – The user instance identifier.

  • name (optional, str) – The name of new user.

  • email (optional, str) – The email address of the user.

  • password (optional, str) – The password for the new user.

  • surname (optional, str) – The surname of new user.

  • department (optional, str) – The department of user.

  • biography (optional, str) – The biography of user.

  • active (optional, bool) – is the user active?

  • picture (optional, List[int]) – The list of picture numbers

Returns

The updated user object.

Return type

dict

Examples

>>> tad.users.update(
...     user_id='1',
...     name='EDITED'
...     )
update_user_roles(user_id: str, roles: List[int]) Dict[source]

Replace role list for user

Parameters
  • user_id (str) – The user instance identifier.

  • roles (List[int]) – The list of user role identifiers.

Returns

updated user roles object

Return type

dict

Examples

>>> tad.users.update_user_roles(
...     user_id='1',
...     roles=[1, 2, 3]
...     )