User

class User(api)

Bases: _IdentityBase

create(name, password, email_address, first_name=None, last_name=None, add_to_everyone_group=True, get_if_already_exists=True)
Parameters
  • name (str) – Name of the user. The local: prefix is not required.

  • password (str) – Password.

  • email_address (str) – E-mail address.

  • first_name (str) – First name of the user.

  • last_name (str) – Last name of the user.

  • add_to_everyone_group (bool) – Add the user to the local:Everyone group.

  • get_if_already_exists (bool) – If the identity already exists, just return it as is.

Returns

Identity Object of the user.

delete(user)

Deletes the user from the Local Identity Provider. The user is removed from all local groups.

Parameters

user (Union[ident.Identity, str]) – Identity Object or Prefixed Name of the user.

exists(prefixed_name)
Parameters

prefixed_name (str) – The Prefixed Name of the identity.

Returns

True if the identity exists, otherwise False.

Return type

bool

find(name, limit=100)

Finds users within the the Identity Providers to which the authenticated user has view permissions.

Parameters
  • name (str) – String of characters contained within the names to be found.

  • limit (int) – Maximum number of results to return.

Returns

List of Identity Object for each user found.

get(prefixed_name=None, prefixed_universal=None, raise_error_if_not_exists=True)

One of prefixed_name or prefixed_universal must be provided.

Parameters
  • prefixed_name (str) – The Prefixed Name of the identity object.

  • prefixed_universal (str) – The prefixed universal of the identity object.

  • raise_error_if_not_exists (bool) – Raise an exception if the identity does not exist.

Returns

Identity Object

get_memberships(identity)
Parameters

identity (Union[ident.Identity, str]) – Identity Object or Prefixed Name of the identity.

Returns

List of Identity Object for each group.

read_attribute(identity, attribute_name)
Parameters
  • identity (Union[ident.Identity, str]) – Identity Object or Prefixed Name of the identity.

  • attribute_name (str) – The name of the attribute.

Returns

List of attribute values.

Return type

List[str]

set_password(user, new_password, old_password=None)

Sets the new_password for a local user. If the user did not have a previous password, then the old_password is not required.

Parameters
  • user (Union[ident.Identity, str]) – Identity Object or Prefixed Name of the user.

  • new_password (str) – The new password for the user.

  • old_password (str) – The old password for the user. Required only if it exists.

Returns

Identity Object of the user.