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¶
|
A handle for a user on the DSS instance. |
|
Settings for a DSS user. |
|
A group on the DSS instance. |
Functions¶
|
Create a group, and return a handle to interact with it |
|
Create a user, and return a handle to interact with it |
|
Deletes the user |
|
Deletes the group |
Get the group's definition (name, description, admin abilities, type, ldap name mapping) |
|
|
Get a handle to interact with a specific group |
|
Get the raw settings of the user. |
Get the settings of the user. |
|
|
Get a handle to interact with a specific user |
List all groups setup on the Agent Management instance |
|
|
List all users setup on the Agent Management instance |
|
Saves the settings |
|
Set the group's definition. |
