Skip to content

Admin

AdminHelper

Bases: object

Handles administrative tasks

__init__(session)

Raise

ClientApiError if unprivileged user

Overlay offering administrative tasks. Initialisation of the class checks if the calling user has admin rights. If the user doesn't, a ClientApiError exception is raised.

Parameters:

Name Type Description Default
session

ClientSession object

required

add_asset_type(name, description)

Add a new Asset Type.

Requires admin rights

Parameters:

Name Type Description Default
name str

Name of the Asset type

required
description str

Description of the Asset type

required

Returns:

Type Description
ApiResponse

ApiResponse

add_customer(customer_name)

Creates a new customer. A new customer can be added if:

  • customer_name is unique

Requires admin rights

Parameters:

Name Type Description Default
customer_name str

Name of the customer to add.

required

Returns:

Type Description

ApiResponse object

add_ioc_type(name, description, taxonomy=None)

Add a new IOC Type.

Requires admin rights

Parameters:

Name Type Description Default
name str

Name of the IOC type

required
description str

Description of the IOC type

required
taxonomy str

Taxonomy of the IOC Type

None

Returns:

Type Description
ApiResponse

ApiResponse

add_user(login, name, password, email, is_admin=False)

Adds a new user. A new user can be successfully added if

  • login is unique
  • email is unique
  • password meets the requirements of IRIS

Requires admin rights

Parameters:

Name Type Description Default
login str

Username (login name) of the user to add

required
name str

Full name of the user

required
password str

Password of the user

required
email str

Email of the user

required
is_admin bool

Set to true if user is admin

False

Returns:

Type Description
ApiResponse

ApiResponse

deactivate_user(user_id=None)

Deactivate a user from its user ID. Disabled users can't login interactively nor user their API keys. They do not appears in proposed user lists.

Requires admin rights

Parameters:

Name Type Description Default
user_id int

User ID to deactivate

None

Returns:

Type Description
ApiResponse

ApiResponse object

delete_asset_type(asset_type_id)

Delete an existing asset type by its ID.

Requires admin rights

Parameters:

Name Type Description Default
asset_type_id int

Asset type to delete

required

Returns:

Type Description
ApiResponse

ApiResponse

delete_customer(customer)

Deletes a customer from its ID or name.

Requires admin rights

Parameters:

Name Type Description Default
customer Union[str, int]

Customer name or customer ID

required

Returns:

Type Description
ApiResponse

ApiResponse object

delete_ioc_type(ioc_type_id)

Delete an existing IOC Type by its ID.

Requires admin rights

Parameters:

Name Type Description Default
ioc_type_id int

IOC type to delete

required

Returns:

Type Description
ApiResponse

ApiResponse

delete_user(login)

Deletes a user based on its login. A user can only be deleted if it does not have any activities in IRIS. This is to maintain coherence in the database.

Requires admin rights

Parameters:

Name Type Description Default
login str

Username (login name) of the user to delete

required

Returns:

Type Description
ApiResponse

ApiResponse

delete_user_by_id(user_id)

Delete a user based on its ID. A user can only be deleted if it does not have any activities in IRIS. This is to maintain coherence in the database.

Requires admin rights

Parameters:

Name Type Description Default
user_id int

UserID of the user to delete

required

Returns:

Type Description
ApiResponse

ApiResponse

get_user(login)

Returns a user by its login. Login names are unique in Iris.

Parameters:

Name Type Description Default
login str

username to lookup

required

Returns:

Type Description
ApiResponse

ApiResponse

is_user_admin()

Returns True if the calling user is administrator

Returns:

Type Description
bool

Bool - true if the calling is administrator

update_asset_type(asset_type_id, name=None, description=None)

Updates an Asset type. asset_type_id needs to be a valid existing AssetType ID.

Requires admin rights

Parameters:

Name Type Description Default
asset_type_id int

Asset type to update

required
name str

Name of the IOC type

None
description str

Description of the IOC type

None

Returns:

Type Description
ApiResponse

ApiResponse

update_customer(customer_id, customer_name)

Updates an existing customer. A customer can be updated if :

  • customer_id is a know customer ID in IRIS
  • customer_name is unique

Requires admin rights

Parameters:

Name Type Description Default
customer_id int

ID of the customer to update

required
customer_name str

Customer name

required

Returns:

Type Description

ApiResponse object

update_ioc_type(ioc_type_id, name=None, description=None, taxonomy=None)

Updates an IOC type. ioc_type_id needs to be a valid existing IocType ID.

Requires admin rights

Parameters:

Name Type Description Default
ioc_type_id int

IOC type to update

required
name str

Name of the IOC type

None
description str

Description of the IOC type

None
taxonomy str

Taxonomy of the IOC Type

None

Returns:

Type Description
ApiResponse

ApiResponse

update_user(login=None, name=None, password=None, email=None, is_admin=None)

Updates a user. The user can be updated if :

  • login is unique
  • email is unique
  • password meets the requirements of IRIS

Password can be left empty to update other attributes.

Requires admin rights

Parameters:

Name Type Description Default
login str

Username (login name) of the user to update

None
name str

Full name of the user

None
password str

Password of the user

None
email str

Email of the user

None
is_admin bool

Set to true if user is admin

None

Returns:

Type Description
ApiResponse

ApiResponse


Last update: 2022-03-20
Back to top