Users

class acouchbase.management.users.UserManager(impl: AsyncUserMgmtInterface)

Performs management operations on users, groups and roles.

async change_password(new_password: str, options: ChangePasswordOptions | None = None, **kwargs: Unpack[ChangePasswordOptionsKwargs]) → None

Changes the password of the currently authenticated user.

The previous credentials stop being valid, so the SDK must be restarted and a new connection established with the new password.

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

  • options (ChangePasswordOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Raises:

InvalidArgumentException – If the new password is not a valid value or type.

async drop_group(group_name: str, options: DropGroupOptions | None = None, **kwargs: Unpack[DropGroupOptionsKwargs]) → None

Drops an existing group.

Parameters:
  • group_name (str) – The name of the group to drop.

  • options (DropGroupOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Raises:

GroupNotFoundException – If the group does not exist.

async drop_user(username: str, options: DropUserOptions | None = None, **kwargs: Unpack[DropUserOptionsKwargs]) → None

Drops an existing user.

Parameters:
  • username (str) – The name of the user to drop.

  • options (DropUserOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Raises:

UserNotFoundException – If the user does not exist.

async get_all_groups(options: GetAllGroupsOptions | None = None, **kwargs: Unpack[GetAllGroupsOptionsKwargs]) → Iterable[Group]

Returns a list of all existing groups.

Parameters:
  • options (GetAllGroupsOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Returns:

A list of existing groups.

Return type:

Iterable[Group]

async get_all_users(options: GetAllUsersOptions | None = None, **kwargs: Unpack[GetAllUsersOptionsKwargs]) → Iterable[UserAndMetadata]

Returns a list of all existing users.

Parameters:
  • options (GetAllUsersOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Returns:

A list of existing users.

Return type:

Iterable[UserAndMetadata]

async get_group(group_name: str, options: GetGroupOptions | None = None, **kwargs: Unpack[GetGroupOptionsKwargs]) → Group

Returns a group by it’s name.

Parameters:
  • group_name (str) – The name of the group to retrieve.

  • options (GetGroupOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Returns:

A Group instance.

Return type:

Group

Raises:

GroupNotFoundException – If the group does not exist.

async get_roles(options: GetRolesOptions | None = None, **kwargs: Unpack[GetRolesOptionsKwargs]) → Iterable[RoleAndDescription]

Returns a list of roles available on the server.

Parameters:
  • options (GetRolesOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Returns:

A list of roles available on the server.

Return type:

Iterable[RoleAndDescription]

async get_user(username: str, options: GetUserOptions | None = None, **kwargs: Unpack[GetUserOptionsKwargs]) → UserAndMetadata

Returns a user by its username.

Parameters:
  • username (str) – The name of the user to retrieve.

  • options (GetUserOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Returns:

The user, with what the server records about it.

Return type:

UserAndMetadata

Raises:

UserNotFoundException – If the user does not exist.

async upsert_group(group: Group, options: UpsertGroupOptions | None = None, **kwargs: Unpack[UpsertGroupOptionsKwargs]) → None

Creates a new group or updates an existing group.

Parameters:
  • group (Group) – The group to create or update.

  • options (UpsertGroupOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Raises:

InvalidArgumentException – If the provided group argument contains an invalid value or type.

async upsert_user(user: User, options: UpsertUserOptions | None = None, **kwargs: Unpack[UpsertUserOptionsKwargs]) → None

Creates a new user or updates an existing user.

Parameters:
  • user (User) – The user to create or update.

  • options (UpsertUserOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used as optional parameters for this operation.

Raises:

InvalidArgumentException – If the provided user argument contains an invalid value or type.

This module also publishes these, described where they are first documented: