Skip to content

Users

class _incydr_sdk.users.client.UsersV1(parent)

Client for /v1/users endpoints.

Usage example:

>>> import incydr
>>> client = incydr.Client(**kwargs)
>>> client.users.v1.get_page()
activate(self, user_id)

Activate a user.

Parameters:

  • user_id: str (required) - The unique ID for the user.

Returns: A requests.Response indicating success.

add_roles(self, user_id, roles)

Add a role, or multiple roles, to a user's existing roles.

Parameters:

  • user_id: str (required) - The unique ID for the user.
  • roles: str | List[str] The roles to add to the user. Accepts either role IDs or role names (case-sensitive)."

Returns: A UpdateRolesResponse object.

deactivate(self, user_id)

Deactivate a user.

Parameters:

  • user_id: str (required) - The unique ID for the user.

Returns: A requests.Response indicating success.

get_devices(self, user_id, active=None, blocked=None, page_num=1, page_size=None, sort_dir=, sort_key=)

Get a page of devices associated with a specific user.

Filter results by passing the appropriate parameters:

Parameters:

  • user_id: str (required) - The unique ID for the user.
  • active: bool - Whether or not the device is active. If true, the device will show up on reports, etc.
  • blocked: bool - Whether or not the device is blocked. If true, restores and logins are disabled.
  • page_num: int - Page number for results. Defaulting to 1.
  • page_size: int - Max number of results to return per page. Defaulting to client's page_size settings.
  • sort_dir: SortDirection - 'asc' or 'desc'. The direction in which to sort the response based on the corresponding key. Defaults to 'asc'.
  • sort_key: SortKeys - One or more values on which the response will be sorted. Defaults to device name.

Returns: A DevicesPage object.

get_page(self, active=None, blocked=None, username=None, page_num=1, page_size=None)

Get a page of users.

Filter results by passing the appropriate parameters:

Parameters:

  • active: bool | None - When true, return only active users. When false, return only inactive users. Defaults to returning both.
  • blocked: bool | None - When true, return only blocked users. When false, return only unblocked users. Defaults to returning both.
  • username: str - The username of a user to search for.
  • page_num: int - Page number for results. Defaulting to 1.
  • page_size: int - Max number of results to return per page. Defaulting to client's page_size setting.

Returns: A UsersPage object.

get_role(self, role)

Get details for a single role.

Parameters:

  • role: str (required) - Role ID or role name (case-sensitive).

Returns: A Role object.

get_user(self, user)

Get a single user.

Parameters:

  • user: str - The unique ID for the user or the username for the user.

Returns: A User object representing the user.

iter_all(self, active=None, blocked=None, username=None, page_size=None)

Iterate over all users.

Accepts the same parameters as .get_page() excepting page_num.

Returns: A generator yielding individual User objects.

list_roles(self)

Get a list of all available roles that can be assigned by the current user.

Parameters:

Returns: A list of Role objects.

list_user_roles(self, user_id)

Get a list of roles associated with a specific user.

Parameters:

  • user_id: str (required) - The unique ID for the user.

Returns: A list of UserRole objects.

move(self, user_id, org_guid)

Move a user to a specified organization

Parameters:

  • user_id: str - The unique ID for the user.
  • org_guid: str The orgGuid of the org to move the user to."

Returns: A requests.Response indicating success.

remove_roles(self, user_id, roles)

Remove a role, or multiple roles, from a user's current roles.

Parameters:

  • user_id: str (required) - The unique ID for the user.
  • roles: str | List[str] The roles to remove from the user. Accepts either role IDs or role names."

Returns: A requests.Response indicating success.

update_roles(self, user_id, roles)

Replace the roles associated with a user.

Parameters:

  • user_id: str (required) - The unique ID for the user.
  • roles: str | List[str] The new roles to assign the user (ex: desktop-user). These will replace the existing roles assigned to the user. Accepts either role IDs or role names."

Returns: A UpdateRolesResponse object.