> For the complete documentation index, see [llms.txt](https://windhoney.gitbook.io/yii2-rest-rbac/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://windhoney.gitbook.io/yii2-rest-rbac/group/group-assign-list.md).

# 分配-用户列表

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

* 接口名称：角色下可选|已分配用户列表
* 请求方式：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": "操作失败",
}
```
