User Creation and Inquiry
Create a User
This document outlines the process for creating users within the SDK, specifically for tenant administrators and standard users. It details the required parameters for user creation, the roles available, and provides examples of how to create both tenant administrators and users using the SDK. Additionally, it includes instructions for retrieving all users associated with a tenant.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| user_name | String | Yes | A unique username for the user |
| String | Yes | The user's email address | |
| password | String | Yes | The password for the user's account |
| first_name | String | Yes | The user's first name |
| last_name | String | Yes | The user's last name |
| roles | List | Yes | A list of roles to assign (["Administrator"] or ["User"]) |
| tenant_id | Integer | Yes | The ID of the tenant to which the user will be associated |
| analytics_id | List | Yes | A list of analytics IDs the user should have access to |
User Roles
| Role | Description |
|---|---|
| Administrator | Full access, typically for tenant administrators |
| User | Limited access, typically for standard users |
Creating a Tenant Admin
To create a tenant administrator, use the following function:
addTenantAdmin = sdk.create_user(
user_name="Cody Solomon",
email="Admin@eizen.ai",
password="1234",
first_name="Cody",
last_name="Solomon",
roles=["Administrator"],
tenant_id=1,
analytics_id=[1]
)
print(addTenantAdmin)
Creating a Tenant User
To create a standard user for the tenant, use the following function:
addTenantUser = sdk.create_user(
user_name="Cody Solomon",
email="User@eizen.ai",
password="1234",
first_name="Cody",
last_name="Solomon",
roles=["User"],
tenant_id=1,
analytics_id=[1]
)
print(addTenantUser)
Notes
- roles: A list of roles to assign (either "Administrator" or "User").
- tenant_id: Must be a valid tenant ID that the current user has access to.
- analytics_id: A list of analytics IDs the user should have access to.
- A password is required.
Get All Users:
To retrieve all users within the tenant, use the following template:
getUsers = sdk.get_all_users()
print(getUsers)
Notes
- Ensure that the SDK is initialized properly with a valid User token before invoking these methods.
- All returned data is typically formatted as a dictionary or list.