Detection Lists

Detection lists have been deprecated. Use Watchlists instead.

class py42.clients.detectionlists.DetectionListsClient(user_profile_service, departing_employee_service, high_risk_employee_service)

Bases: object

Deprecated. Use :class:`~py42.clients.watchlists.WatchlistsClient and UserRiskProfileClient instead. Rest documentation <https://developer.code42.com/api/#tag/Detection-Lists>`__

add_user_cloud_alias(user_id, alias)

Deprecated. Use userriskprofile.add_cloud_aliases() instead. Add a cloud alias to a user. Rest Documentation

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

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

Returns

py42.response.Py42Response

add_user_risk_tags(user_id, tags)

Deprecated. Use watchlists instead. Add one or more risk factor tags. Rest Documentation

Parameters
  • user_id (str or int) – The userUid of the user 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"].

    Constants available at py42.constants.RiskTags

Returns

py42.response.Py42Response

create_user(username)

Deprecated. Used to create a detection list profile for a user, but now that happens automatically. Thus, this method instead returns the response from an API call that gets the user’s profile.

Parameters

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

Returns

py42.response.Py42Response

get_user(username)

Deprecated. Use userriskprofile.get_by_username() instead. Get user details by username. Rest Documentation

Parameters

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

Returns

py42.response.Py42Response

get_user_by_id(user_id)

Deprecated. Use userriskprofile.get_by_id() instead. Get user details by user_id. Rest Documentation

Parameters

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

Returns

py42.response.Py42Response

refresh_user_scim_attributes(user_id)

Deprecated. Refresh SCIM attributes of a user. Rest Documentation

Parameters

user_id (str or int) – The userUid of the user whose attributes you wish to refresh.

Returns

py42.response.Py42Response

remove_user_cloud_alias(user_id, alias)

Deprecated. Use userriskprofile.delete_cloud_aliases() instead. Remove a cloud alias from a user. Rest Documentation

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

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

Returns

py42.response.Py42Response

remove_user_risk_tags(user_id, tags)

Deprecated. Use watchlists instead. Remove one or more risk factor tags. Rest Documentation

Parameters
  • user_id (str or int) – The userUid of the user 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"].

    Constants available at py42.constants.RiskTags

Returns

py42.response.Py42Response

update_user_notes(user_id, notes)

Deprecated. Use userriskprofile.update() instead. Add or update notes related to the user. Rest Documentation

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

  • notes (str) – User profile notes.

Returns

py42.response.Py42Response

Departing Employees

class py42.services.detectionlists.departing_employee.DepartingEmployeeFilters

Bases: py42.services.detectionlists._DetectionListFilters, py42.choices.Choices

Deprecated. Use WatchlistsClient and UserRiskProfileClient instead. Constants available for filtering Departing Employee search results.

  • OPEN

  • EXFILTRATION_30_DAYS

  • EXFILTRATION_24_HOURS

  • LEAVING_TODAY

class py42.services.detectionlists.departing_employee.DepartingEmployeeService(session, user_context, user_profile_service)

Bases: py42.services.BaseService

Deprecated. Use WatchlistsClient and UserRiskProfileClient instead. A service for interacting with Code42 Departing Employee APIs.

add(user_id, departure_date=None)

Deprecated. Use watchlists instead. Adds a user to the Departing Employees list. REST Documentation

Raises a Py42UserAlreadyAddedError 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 or datetime, optional) – Date in yyyy-MM-dd format or instance of datetime. Date is treated as UTC. Defaults to None.

Returns

py42.response.Py42Response

get(user_id)

Deprecated. Use userriskprofile.get_by_id() instead. Gets departing employee data of a user. REST Documentation

Parameters

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

Returns

py42.response.Py42Response

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

Deprecated. Use userriskprofile.get_all(). Gets all Departing Employees.

Parameters
  • filter_type (str, optional) – Constants available at py42.constants.DepartingEmployeeFilters. Defaults to “OPEN”.

  • sort_key (str, optional) – Sort results based by field. Defaults to “CREATED_AT”.

  • sort_direction (str, optional) – ASC or DESC. Defaults to “DESC”.

  • page_size (int, optional) – The number of departing employees to return per page. Defaults to 100.

Returns

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

Return type

generator

get_page(page_num, filter_type='OPEN', sort_key='CREATED_AT', sort_direction='DESC', page_size=100)

Deprecated. Use userriskprofile.get_page() instead. Gets a single page of Departing Employees.

Parameters
  • page_num (int) – The page number to request.

  • filter_type (str, optional) – Constants available at py42.constants.DepartingEmployeeFilters. Defaults to “OPEN”.

  • sort_key (str, optional) – Sort results based by field. Defaults to “CREATED_AT”.

  • sort_direction (str. optional) – ASC or DESC. Defaults to “DESC”.

  • page_size (int, optional) – The number of departing employees to return per page. Defaults to 100.

Returns

py42.response.Py42Response

remove(user_id)

Deprecated. Use watchlists instead. 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)

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

Parameters

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)

Deprecated. Use userriskprofile.update() instead. Add or modify details of an existing Departing Employee case. REST Documentation

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

  • departure_date (str or datetime) – Date in yyyy-MM-dd format or instance of datetime. Date is treated as UTC.

Returns

py42.response.Py42Response

High Risk Employee

class py42.clients.detectionlists.RiskTags

Bases: py42.choices.Choices

Deprecated. Use WatchlistsClient and UserRiskProfileClient instead. Constants available as risk tags for add_user_risk_tags() and remove_user_risk_tags().

  • FLIGHT_RISK

  • HIGH_IMPACT_EMPLOYEE

  • ELEVATED_ACCESS_PRIVILEGES

  • PERFORMANCE_CONCERNS

  • SUSPICIOUS_SYSTEM_ACTIVITY

  • POOR_SECURITY_PRACTICES

  • CONTRACT_EMPLOYEE

class py42.services.detectionlists.high_risk_employee.HighRiskEmployeeFilters

Bases: py42.services.detectionlists._DetectionListFilters, py42.choices.Choices

Deprecated. Use WatchlistsClient and UserRiskProfileClient instead. Constants available for filtering High Risk Employee search results.

  • OPEN

  • EXFILTRATION_30_DAYS

  • EXFILTRATION_24_HOURS

class py42.services.detectionlists.high_risk_employee.HighRiskEmployeeService(connection, user_context, user_profile_service)

Bases: py42.services.BaseService

Deprecated. Use :class:`~py42.clients.watchlists.WatchlistsClient and UserRiskProfileClient instead. A service for interacting with High Risk Employee APIs.

add(user_id)

Deprecated. Use watchlists instead. Adds a user to the High Risk Employee detection list.

Raises a Py42UserAlreadyAddedError when a user already exists in the High Risk Employee detection list. REST Documentation

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)

Deprecated. Use userriskprofile.get_by_id() instead. Gets user information. Rest Documentation

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, page_size=100)

Deprecated. Use userriskprofile.get_all() instead. Searches High Risk Employee list. Filter results by filter_type. Rest Documentation

Parameters
  • filter_type (str, optional) – Constants available at py42.constants.HighRiskEmployeeFilters. Defaults to OPEN.

  • sort_key (str, optional) – Sort results based by field. Defaults to None.

  • sort_direction (str, optional) – ASC or DESC. Constants available at py42.constants.SortDirection. Defaults to None.

  • page_size (int, optional) – The number of high risk employees to return per page. Defaults to 100.

Returns

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

Return type

generator

get_page(page_num, filter_type='OPEN', sort_key=None, sort_direction=None, page_size=100)

Deprecated. Use userriskprofile.get_page() instead. Gets a single page of High Risk Employees.

Parameters
  • page_num (int) – The page number to request.

  • filter_type (str, optional) – Constants available at py42.constants.HighRiskEmployeeFilters. Defaults to “OPEN”.

  • sort_key (str, optional) – Sort results based by field. Defaults to None.

  • sort_direction (str. optional) – ASC or DESC. Constants available at py42.constants.SortDirection. Defaults to None.

  • page_size (int, optional) – The number of high risk employees to return per page. Defaults to 100.

Returns

py42.response.Py42Response

remove(user_id)

Deprecated. Use watchlists instead. Removes a user from the High Risk Employee detection list. Rest Documentation

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)

Deprecated. Enables alerts. Rest Documentation

Parameters

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

Returns

py42.response.Py42Response