Roles (risksense_api.__subject.__role.__role)

Role module defined for different role related api endpoints.

class risksense_api.__subject.__role.__role.Role(profile)[source]

Bases: Subject

Class for role function definitions.

Parameters:

profile (object) – Profile Object

To utlise role function:

Usage:

self.{risksenseobjectname}.roles.{function}

Examples

To create a role using create() function

>>> self.rs.roles.create(args)
__init__(profile)[source]

Initialization of Roles object.

Parameters:

profile (object) – Profile Object

create(name, description, client_id=None)[source]

Create a new role.

Parameters:
  • name (str) – The name for the new network.

  • decription – The description of the role.

  • client_id (typing.Optional[int]) – Client ID. If an ID isn’t passed, will use the profile’s default Client ID.

Return type:

int

Returns:

The new role ID.

Examples

>>> apiobj = self.{risksenseobject}.users.create('test','test')
Parameters:

description (str) –

allow_privileges(roleid, client_id=None)[source]

Allow privileges to a role.

Parameters:
  • roleid (int) – Rold Id

  • client_id (typing.Optional[int]) – Client ID. If an ID isn’t passed, will use the profile’s default Client ID.

Return type:

bool

Returns:

Job State

Examples

>>> apiobj = self.{risksenseobject}.users.allow_privileges(1234)
deny_privileges(roleid, client_id=None)[source]

Deny privileges to a role.

Parameters:
  • roleid (int) – Rold Id

  • client_id (typing.Optional[int]) – Client ID. If an ID isn’t passed, will use the profile’s default Client ID.

Return type:

bool

Returns:

Job State

Examples

>>> apiobj = self.{risksenseobject}.users.deny_privileges(1234)
delete_privileges(roleid, client_id=None)[source]

Delete privileges to a role.

Parameters:
  • roleid (int) – Rold Id

  • client_id (typing.Optional[int]) – Client ID. If an ID isn’t passed, will use the profile’s default Client ID.

Return type:

bool

Returns:

Job State

Examples

>>> apiobj = self.{risksenseobject}.users.delete_privileges(1234)
get_privileges(client_id=None)[source]

Get privileges to a role.

Parameters:

client_id (typing.Optional[int]) – Client ID. If an ID isn’t passed, will use the profile’s default Client ID.

Return type:

tuple

Returns:

(Privilege Id, Privilege Name)

Examples

>>> apiobj = self.{risksenseobject}.users.get_privileges()
update(roleid, name, description, client_id=None)[source]

Update a new role.

Parameters:
  • roleid (int) – Rold Id

  • name (str) – The name for the new role.

  • description (str) – The description of the role.

  • client_id (typing.Optional[int]) – Client ID. If an ID isn’t passed, will use the profile’s default Client ID.

Return type:

int

Returns:

The new role ID.

Examples

>>> apiobj = self.{risksenseobject}.users.update(123,'test','test')
delete_role(roleid, client_id=None)[source]

Update a new role.

Parameters:
  • roleid (int) – Rold Id

  • client_id (typing.Optional[int]) – Client ID. If an ID isn’t passed, will use the profile’s default Client ID.

Return type:

bool

Returns:

State(True/False)

Examples

>>> apiobj = self.{risksenseobject}.users.delete_role('xxxx')