Users and groups

The Agent Management client exposes user and group administration methods directly. They return the shared DSS user and group handles on the same Agent Management instance.

In the following examples, client is an AgentManagementClient created as described in The main AgentManagementClient class. User and group administration requires instance administration rights.

Listing users and groups

for user in client.list_users():
    print(user["login"], user.get("displayName"))
for group in client.list_groups():
    print(group["name"])

Creating a group and user

This example assumes the group and login do not exist. Choose a user profile allowed by your Agent Management license; the example uses REGULAR_USER.

import getpass

group = client.create_group(
    "agent-operators",
    description="Agent Management operators",
    source_type="LOCAL",
)
user = client.create_user(
    "agent-operator",
    password=getpass.getpass("Password for the new user: "),
    display_name="Agent operator",
    groups=["agent-operators"],
    profile="REGULAR_USER",
)

Creating a group does not grant it platform or agent access. See Owners and permissions to assign permissions and ownership.

Updating a user

user = client.get_user("agent-operator")
settings = user.get_settings()
settings.get_raw()["displayName"] = "Support agent operator"
settings.get_raw()["email"] = "[email protected]"
groups = settings.get_raw().setdefault("groups", [])
if "agent-operators" not in groups:
    groups.append("agent-operators")
settings.save()

Updating a group

group = client.get_group("agent-operators")
definition = group.get_definition()
definition["description"] = "Operators responsible for production agents"
group.set_definition(definition)

Deleting a user or group

client.get_user("unused-agent-operator").delete()
client.get_group("unused-agent-group").delete()

Reference documentation

Classes

dataikuapi.dss.admin.DSSUser(client, login)

A handle for a user on the DSS instance.

dataikuapi.dss.admin.DSSUserSettings(client, ...)

Settings for a DSS user.

dataikuapi.dss.admin.DSSGroup(client, name)

A group on the DSS instance.

Functions

create_group(name[, description, source_type])

Create a group, and return a handle to interact with it

create_user(login, password[, display_name, ...])

Create a user, and return a handle to interact with it

delete([allow_self_deletion])

Deletes the user

delete()

Deletes the group

get_definition()

Get the group's definition (name, description, admin abilities, type, ldap name mapping)

get_group(name)

Get a handle to interact with a specific group

get_raw()

Get the raw settings of the user.

get_settings()

Get the settings of the user.

get_user(login)

Get a handle to interact with a specific user

list_groups()

List all groups setup on the Agent Management instance

list_users([as_objects, include_settings])

List all users setup on the Agent Management instance

save()

Saves the settings

set_definition(definition)

Set the group's definition.