From 5a220caf39de27e5b6f5d80d864d912c7903b8b6 Mon Sep 17 00:00:00 2001 From: Thomas Heartman Date: Tue, 8 Feb 2022 08:04:51 +0100 Subject: [PATCH 1/3] docs: Add payload properties for user-admin post payload Adds an explanation of what the various properties in the payload object to the `user-admin` endpoint does. Most seem fairly self-explanatory, but I'm not entirely sure what `sendEmail` does. Requires validation by a third party before merging. --- website/docs/api/admin/user-admin.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/website/docs/api/admin/user-admin.md b/website/docs/api/admin/user-admin.md index 210a503db1..067c39f075 100644 --- a/website/docs/api/admin/user-admin.md +++ b/website/docs/api/admin/user-admin.md @@ -115,7 +115,17 @@ You can also search for users via the search API. It will preform a simple searc `POST https://unleash.host.com/api/admin/user-admin` -Creates a new use with the given root role. +Creates a new user with the given root role. + +**Payload properties** + +| Property name | Required | Description | Example value(s) | +|---------------|----------|---------------------------------------------------------------------------------|------------------------| +| `email` | Yes | The user's email address. | `"user@getunleash.io"` | +| `name` | Yes | The user's name | `"Some Name"` | +| `rootRole` | Yes | The role to assign to the user. Can be either the role's ID or its unique name. | `2`, `"Editor"` | +| `sendEmail` | No | Whether to send a registration email to the user or not. Defaults to `true`. | `false` | + **Body** @@ -128,12 +138,6 @@ Creates a new use with the given root role. } ``` -**Notes** - -- `email` - Required field. -- `rootRole` - can either be the role id or the unique name of the role (e.g: `Editor`). -- `sendEmail` - set to `true` if you want Unleash to send Welcome email to the new user. Do require the Unleash instance to be configured with email settings. - #### Return values: {#return-values} `201: Created` From 4c4f6a3aaad0a73d5472944882d52d64d1280e11 Mon Sep 17 00:00:00 2001 From: Thomas Heartman Date: Thu, 3 Mar 2022 15:24:15 +0100 Subject: [PATCH 2/3] docs: update description of sendEmail option --- website/docs/api/admin/user-admin.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/website/docs/api/admin/user-admin.md b/website/docs/api/admin/user-admin.md index 067c39f075..9ea63af5a7 100644 --- a/website/docs/api/admin/user-admin.md +++ b/website/docs/api/admin/user-admin.md @@ -119,12 +119,12 @@ Creates a new user with the given root role. **Payload properties** -| Property name | Required | Description | Example value(s) | -|---------------|----------|---------------------------------------------------------------------------------|------------------------| -| `email` | Yes | The user's email address. | `"user@getunleash.io"` | -| `name` | Yes | The user's name | `"Some Name"` | -| `rootRole` | Yes | The role to assign to the user. Can be either the role's ID or its unique name. | `2`, `"Editor"` | -| `sendEmail` | No | Whether to send a registration email to the user or not. Defaults to `true`. | `false` | +| Property name | Required | Description | Example value(s) | +|---------------|----------|-------------------------------------------------------------------------------------------|------------------------| +| `email` | Yes | The user's email address. | `"user@getunleash.io"` | +| `name` | Yes | The user's name | `"Some Name"` | +| `rootRole` | Yes | The role to assign to the user. Can be either the role's ID or its unique name. | `2`, `"Editor"` | +| `sendEmail` | No | Whether to send a welcome email with a login link to the user or not. Defaults to `true`. | `false` | **Body** From 6d433c50ab66b9d539da8e31f417b126053aac37 Mon Sep 17 00:00:00 2001 From: Thomas Heartman Date: Fri, 4 Mar 2022 10:36:40 +0100 Subject: [PATCH 3/3] docs: add info about requiring `name` OR `email` --- website/docs/api/admin/user-admin.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/website/docs/api/admin/user-admin.md b/website/docs/api/admin/user-admin.md index 9ea63af5a7..e410b966f0 100644 --- a/website/docs/api/admin/user-admin.md +++ b/website/docs/api/admin/user-admin.md @@ -119,10 +119,14 @@ Creates a new user with the given root role. **Payload properties** +:::info Requirements +The payload **must** contain **at least one of** the `name` and `email` properties, though which one is up to you. For the user to be able to log in to the system, the user **must** have an email. +::: + | Property name | Required | Description | Example value(s) | |---------------|----------|-------------------------------------------------------------------------------------------|------------------------| -| `email` | Yes | The user's email address. | `"user@getunleash.io"` | -| `name` | Yes | The user's name | `"Some Name"` | +| `email` | No | The user's email address. Must be provided if `name` is not provided. | `"user@getunleash.io"` | +| `name` | No | The user's name. Must be provided if `email` is not provided. | `"Some Name"` | | `rootRole` | Yes | The role to assign to the user. Can be either the role's ID or its unique name. | `2`, `"Editor"` | | `sendEmail` | No | Whether to send a welcome email with a login link to the user or not. Defaults to `true`. | `false` |