chore!: allow CreateUser to accept multiple organizations (#14383)

* chore: allow CreateUser to accept multiple organizations

In a multi-org deployment, it makes more sense to allow for multiple
org memberships to be assigned at create. The legacy param will still
be honored.

* Handle sdk deprecation better by maintaining cli functions
This commit is contained in:
Steven Masley
2024-08-23 16:23:51 -05:00
committed by GitHub
parent af125c3795
commit c8eacc6df7
28 changed files with 597 additions and 367 deletions

View File

@@ -1284,15 +1284,14 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
| `scope` | `all` |
| `scope` | `application_connect` |
## codersdk.CreateUserRequest
## codersdk.CreateUserRequestWithOrgs
```json
{
"disable_login": true,
"email": "user@example.com",
"login_type": "",
"name": "string",
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
"organization_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"],
"password": "string",
"username": "string"
}
@@ -1300,15 +1299,14 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
### Properties
| Name | Type | Required | Restrictions | Description |
| ----------------- | ---------------------------------------- | -------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `disable_login` | boolean | false | | Disable login sets the user's login type to 'none'. This prevents the user from being able to use a password or any other authentication method to login. Deprecated: Set UserLoginType=LoginTypeDisabled instead. |
| `email` | string | true | | |
| `login_type` | [codersdk.LoginType](#codersdklogintype) | false | | Login type defaults to LoginTypePassword. |
| `name` | string | false | | |
| `organization_id` | string | false | | |
| `password` | string | false | | |
| `username` | string | true | | |
| Name | Type | Required | Restrictions | Description |
| ------------------ | ---------------------------------------- | -------- | ------------ | ----------------------------------------------------------------------------------- |
| `email` | string | true | | |
| `login_type` | [codersdk.LoginType](#codersdklogintype) | false | | Login type defaults to LoginTypePassword. |
| `name` | string | false | | |
| `organization_ids` | array of string | false | | Organization ids is a list of organization IDs that the user should be a member of. |
| `password` | string | false | | |
| `username` | string | true | | |
## codersdk.CreateWorkspaceBuildRequest

View File

@@ -81,11 +81,10 @@ curl -X POST http://coder-server:8080/api/v2/users \
```json
{
"disable_login": true,
"email": "user@example.com",
"login_type": "",
"name": "string",
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
"organization_ids": ["497f6eca-6276-4993-bfeb-53cbbbba6f08"],
"password": "string",
"username": "string"
}
@@ -93,9 +92,9 @@ curl -X POST http://coder-server:8080/api/v2/users \
### Parameters
| Name | In | Type | Required | Description |
| ------ | ---- | ------------------------------------------------------------------ | -------- | ------------------- |
| `body` | body | [codersdk.CreateUserRequest](schemas.md#codersdkcreateuserrequest) | true | Create user request |
| Name | In | Type | Required | Description |
| ------ | ---- | ---------------------------------------------------------------------------------- | -------- | ------------------- |
| `body` | body | [codersdk.CreateUserRequestWithOrgs](schemas.md#codersdkcreateuserrequestwithorgs) | true | Create user request |
### Example responses