User

Functions

wrapica.user.coerce_user_id_or_name_to_user_id(user_id_or_user_name)

Given either a user id or name, coerce to user id

Parameters:

user_id_or_user_name (str)

Return type:

str

Returns:

The user id

wrapica.user.coerce_user_id_or_name_to_user_obj(user_id_or_user_name)

Given either a user id or name, coerce to user object

Parameters:

user_id_or_user_name (str)

Returns:

The user object

Return type:

User

Raises:
  • ValueError – If the user name is not found

  • ApiException – If an error occurs when collecting the users

Example:

1my_user: User = coerce_user_id_or_user_name_to_user_obj("user_id")
wrapica.user.get_tenant_id_for_user()

Get user and return tenant id from user

Returns:

The tenant id

Return type:

str

wrapica.user.get_user_id_from_configuration()

Use jwt to get username from access token

Returns:

The user id

Return type:

str

wrapica.user.get_user_name_from_user_id(user_id)

Get the user name from the user id

Parameters:

user_id (Union[UUID, str]) – The user id

Returns:

The user name

Return type:

str

wrapica.user.get_user_obj_from_user_id(user_id)

Get the user object from the user id

Parameters:

user_id (Union[UUID, str])

Return type:

User

Returns:

User

wrapica.user.get_user_obj_from_user_name(user_name)

Get the user object from the user name Lists through all user objects, when we have both user id and user name, use get_user_from_user_id instead

Parameters:

user_name (str)

Returns:

The user object

Return type:

User

Raises:
  • ApiException – If an error occurs when collecting the users

  • ValueError – If the user name is not found