Detection Lists

class py42.modules.detectionlists.DetectionListsModule(microservice_client_factory)

Bases: object

add_user_cloud_alias(user_id, alias)

Add a cloud alias to a user.

Parameters
  • user_id (str or int) – The Code42 userUid whose alias you want to update.

  • alias (str) – The alias to be added.

Returns

py42.response.Py42Response

add_user_risk_tags(user_id, tags)

Add one or more risk factor tags.

Parameters
  • user_id (str or int) – The Code42 userUid whose risk factor tag(s) you want to update.

  • tags (str or list of str) – A single tag or multiple tags in a list to be added. For example: "tag1" or ["tag1", "tag2"]. For python version 2.X, pass u"str" instead of "str".

Returns

py42.response.Py42Response

create_user(username)

Create a detection list profile for a user.

Parameters

username (str) – The Code42 username of the user.

Returns

py42.response.Py42Response

get_user(username)

Get user details by username.

Parameters

username (str) – The Code42 username of the user.

Returns

py42.response.Py42Response

get_user_by_id(user_id)

Get user details by user_id.

Parameters

user_id (str or int) – The Code42 userId of the user.

Returns

py42.response.Py42Response

remove_user_cloud_alias(user_id, alias)

Remove a cloud alias from a user.

Parameters
  • user_id (str or int) – The user_id whose alias needs to be removed.

  • alias (str) – The alias to be removed.

Returns

py42.response.Py42Response

remove_user_risk_tags(user_id, tags)

Remove one or more risk factor tags.

Parameters
  • user_id (str or int) – The Code42 userUid whose risk factor tag(s) needs you want to remove.

  • tags (str or list of str) – A single tag or multiple tags in a list to be removed. For example: "tag1" or ["tag1", "tag2"]. For python version 2.X, pass u"str" instead of "str".

Returns

py42.response.Py42Response

update_user_notes(user_id, notes)

Add or update notes related to the user.

Parameters
  • user_id (str or int) – The Code42 userUid whose notes you want to update.

  • notes (str) – User profile notes.

Returns

py42.response.Py42Response

Departing Employees

class py42.clients.detectionlists.departing_employee.DepartingEmployeeClient(session, user_context, detection_list_user_client)

Bases: py42.clients.BaseClient

A client for interacting with Code42 Departing Employee APIs.

add(user_id, departure_date=None)
Adds a user to the Departing Employees list. Creates a detection list user profile if one

didn’t already exist.

REST Documentation

Raises a Py42BadRequestError when a user already exists in the Departing Employee detection list.

Parameters
  • user_id (str or int) – The Code42 userUid of the user you want to add to the departing employees list.

  • departure_date (str, optional) – Date in YYYY-MM-DD format. Date is treated as UTC. Defaults to None.

Returns

py42.response.Py42Response

get(user_id)

Gets departing employee data of a user. REST Documentation

Parameters

user_id (str or int) – The Code42 userUid of the user.

Returns

py42.sdk.response.Py42Response

get_all(filter_type='OPEN', sort_key='CREATED_AT', sort_direction='DESC')

Gets all Departing Employees.

Parameters
  • filter_type (str, optional) – Filter results by status. Defaults to “OPEN”.

  • sort_key (str, optional) – Key to sort results on. Options: (CREATED_AT, DEPARTURE_DATE, DISPLAY_NAME, NUM_EVENTS, TOTAL_BYTES). Defaults to CREATED_AT.

  • sort_direction (str, optional) – Sort direction. Options: (ASC, DESC). Defaults to DESC.

Returns

An object that iterates over py42.response.Py42Response objects that each contain a page of departing employees.

Return type

generator

remove(user_id)

Removes a user from the Departing Employees list. REST Documentation

Parameters

user_id (str or int) – The Code42 userUid of the user.

Returns

py42.response.Py42Response

set_alerts_enabled(alerts_enabled=True)

Enable or disable email alerting on Departing Employee exposure events. REST Documentation

Parameters
  • tenant_id (str, optional) – The unique identifier of the customer tenant. Defaults to None (the tenant_id of SDK authorization user will be used).

  • alerts_enabled (bool) – Set alerting to on (True) or off (False). Defaults to True.

Returns

py42.response.Py42Response

update_departure_date(user_id, departure_date)

Add or modify details of an existing Departing Employee case. REST Documentation

Parameters
  • user_id (str) – The Code42 userUid of the user.

  • departure_date (date) – Date in YYYY-MM-DD format. Date is treated as UTC.

Returns

py42.sdk.response.Py42Response

High Risk Employee

class py42.clients.detectionlists.high_risk_employee.HighRiskEmployeeClient(session, user_context, detection_list_user_client)

Bases: py42.clients.BaseClient

A client for interacting with High Risk Employee APIs.

add(user_id)

Adds a user to the High Risk Employee detection list. Creates a detection list user profile if one didn’t already exist.

Raises a Py42BadRequestError when a user already exists in the High Risk Employee detection list.

Parameters

user_id (str or int) – The Code42 userUid of the user you want to add to the High Risk Employee detection list.

Returns

py42.response.Py42Response

get(user_id)

Get user information.

Parameters

user_id (str or int) – The Code42 userUid of the user has been added to the High Risk Employee detection list.

Returns

py42.response.Py42Response

get_all(filter_type='OPEN', sort_key=None, sort_direction=None)

Search High Risk Employee list. Filter results by filter_type.

Parameters
  • filter_type (str) – Valid filter types.

  • sort_key (str) – Sort results based by field.

  • sort_direction (str) – ASC or DESC

Returns

An object that iterates over py42.response.Py42Response objects that each contain a page of users.

Return type

generator

remove(user_id)

Remove a user from the High Risk Employee detection list.

Parameters

user_id (str or int) – The Code42 userUid of the user you want to add to the High Risk Employee detection list.

Returns

py42.response.Py42Response

set_alerts_enabled(enabled=True)

Enable alerts.

Parameters

enabled (bool) – Whether to enable alerts for all users.

Returns

py42.response.Py42Response