## Assign Role To User In Organization

`client.Organizations.Users.AssignRole(ctx, organizationID, body) (*UserOrganizationRole, error)`

**put** `/api/v1/organizations/{organization_id}/users/roles`

Assign a role to a user in an organization.

### Parameters

- `organizationID string`

- `body OrganizationUserAssignRoleParams`

  - `OrganizationID param.Field[string]`

    The organization's ID.

  - `RoleID param.Field[string]`

    The role's ID.

  - `UserID param.Field[string]`

    The user's ID.

### Returns

- `type UserOrganizationRole struct{…}`

  Schema for a user's role in an organization.

  - `ID string`

    Unique identifier

  - `OrganizationID string`

    The organization's ID.

  - `Role Role`

    The role.

    - `ID string`

      Unique identifier

    - `Name string`

      A name for the role.

    - `Permissions []RolePermission`

      The actual permissions of the role.

      - `ID string`

        Unique identifier

      - `Access bool`

        Whether the permission is granted or not.

      - `Description string`

        A description for the permission.

      - `Name string`

        A name for the permission.

      - `CreatedAt Time`

        Creation datetime

      - `UpdatedAt Time`

        Update datetime

    - `CreatedAt Time`

      Creation datetime

    - `UpdatedAt Time`

      Update datetime

  - `UserID string`

    The user's ID.

  - `CreatedAt Time`

    Creation datetime

  - `ProjectIDs []string`

    The project ID scope.

  - `UpdatedAt Time`

    Update datetime

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/run-llama/llamacloud-admin-go"
  "github.com/run-llama/llamacloud-admin-go/option"
)

func main() {
  client := llamacloudadmin.NewClient(
    option.WithAPIKey("My API Key"),
  )
  userOrganizationRole, err := client.Organizations.Users.AssignRole(
    context.TODO(),
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    llamacloudadmin.OrganizationUserAssignRoleParams{
      OrganizationID: "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      RoleID: "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      UserID: "user_id",
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", userOrganizationRole.ID)
}
```

#### Response

```json
{
  "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "organization_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "role": {
    "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "name": "x",
    "permissions": [
      {
        "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
        "access": true,
        "description": "description",
        "name": "x",
        "created_at": "2019-12-27T18:11:19.117Z",
        "updated_at": "2019-12-27T18:11:19.117Z"
      }
    ],
    "created_at": "2019-12-27T18:11:19.117Z",
    "updated_at": "2019-12-27T18:11:19.117Z"
  },
  "user_id": "user_id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "project_ids": [
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
  ],
  "updated_at": "2019-12-27T18:11:19.117Z"
}
```
