# 分配-用户列表

## **角色用户列表**

* 接口名称：角色下可选|已分配用户列表
* 请求方式：get
* 请求示例：[/rbac/groups/assign-user?id=1134620\&single\_group=1](https://github.com/windhoney/yii2-rest-rbac/tree/5607a3fc72fd54f761435b601794fd2091885740/%7B%7Bbook.api_url%7D%7D/rbac/groups/assign-user?id=1134620\&single_group=1/README.md)
* 请求参数说明：

| 元素名称          | 数据类型   | 是否非空 | 元素说明         | 备注          |
| ------------- | ------ | ---- | ------------ | ----------- |
| id            | string | 是    | 角色id         | --          |
| single\_group | string | 是    | 是否用户只能属于一个店铺 | 1是 0不是(可不传) |

## **返回信息：**

* 数据格式：JSON&#x20;
* data参数说明：

| 元素名称   | 数据类型 | 是否非空 | 元素说明   | 备注  |
| ------ | ---- | ---- | ------ | --- |
| all    | \[]  | 是    | 所有可选用户 | --- |
| assign | \[]  | 是    | 已分配用户  | --- |

* \[ ]参数说明

| 元素名称     | 数据类型   | 是否非空 | 元素说明 | 备注  |
| -------- | ------ | ---- | ---- | --- |
| id       | string | 是    | 用户ID | --- |
| realname | string | 是    | 用户名  | --- |

* 成功示例：&#x20;

```php
{
    "code": 200,
    "message": "OK",
    "data": {
        "all": [
            {
                "id": "9",
                "realname": "张"
            },
            {
                "id": "2812",
                "realname": "李"
            },
            {
                "id": "3242",
                "realname": "张123"
            }
        ],
        "assign": [
            {
                "id": "1",
                "realname": "王"
            },
            {
                "id": "2",
                "realname": "王1123"
            },
            {
                "id": "4",
                "realname": "赵123"
            }
        ]
    }
}
```

* 失败示例：

```php
{
    "code": 400,
    "message": "操作失败",
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://windhoney.gitbook.io/yii2-rest-rbac/group/group-assign-list.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
