Roles

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

class RolesAPI(api: APISession)[source]
copy_role(from_id: str, name: str) Dict[source]

Creates a new role from another role

Parameters:
  • from_id (str) – The role instance identifier user wants to copy.

  • name (str) – The name of new role.

Returns:

the copied role object.

Return type:

dict

Examples

>>> tie.roles.copy_role(
...     from_id='1',
...     name='Copied name'
...     )
create(name: str, description: int) List[Dict][source]

Create a new role

Parameters:
  • name (str) – The name of role.

  • description (str) – The description of role.

Returns:

The created role object.

Return type:

list[dict]

Examples

>>> tie.roles.create(
...     name='Admin',
...     description="all privileges"
...     )
default_roles() List[Dict][source]

Return the default roles for user creation

Returns:

The default roles object.

Return type:

list[dict]

Examples

>>> tie.roles.default_roles()
delete(role_id: str) None[source]

Delete an existing role

Parameters:

role_id (str) – The role instance identifier.

Return type:

None

Examples

>>> tie.roles.delete(
...     role_id='1',
...     )
details(role_id: str) Dict[source]

Retrieves the details of a specific role.

Parameters:

role_id (str) – The role instance identifier.

Returns:

the role object.

Return type:

dict

Examples

>>> tie.roles.details(
...     role_id='1'
...     )
list() List[Dict][source]

Retrieve all roles

Returns:

The list of roles objects

Return type:

list[dict]

Examples

>>> tie.roles.list()
replace_role_permissions(role_id: str, permissions: List[Dict]) Dict[source]

Replace permission list for a role

Parameters:
  • role_id (str) – The role instance identifier.

  • permissions (List[Dict]) – The list of permissions dictionaries. Below are the values expected in dictionaries

  • entity_name (str) – The name of entity.

  • action (str) – The code of action to perform.

  • entity_ids (List[int]) – The list of entity identifiers.

  • dynamic_id (optional, str) – The dynamicId to use associated with the action.

Returns:

the update permissions role object.

Return type:

dict

Examples

>>> tie.roles.replace_role_permissions(
...     role_id='1',
...     permissions=[{
...         'entity_name':'dashboard',
...         'action':'action',
...         'entity_ids':[1, 2],
...         'dynamic_id': None
...     }]
... )
update(role_id: str, **kwargs) Dict[source]

Update an existing role

Parameters:
  • role_id (str) – The role instance identifier.

  • name (optional, str) – The name of role.

  • description (optional, str) – The description of role.

Returns:

The updated widget object.

Return type:

dict

Examples

>>> tie.roles.update(
...     role_id='1',
...     name='Basic'
...     )