integer/array user.get(object parameters) 此方法允许根据给定的参数检索用户。
integer/array user.get(object parameters)
The method allows to retrieve users according to the given parameters.
(object) 定义所需输出的参数。
该方法支持以下参数。
| 属性 类 | 说明 | |
|---|---|---|
| mediaids | string/array | 只返回用户给定媒体。 |
| mediatypeids | string/array | 只返回用户给定媒体类型。 |
| userids | string/array | 只返回用户给定ID。 |
| usrgrpids | string/array | 只返回用户给定用户组ID。 |
| getAccess | flag | 添加关于用户权限附加信息。 为每个用户添加以下属性: gui_access - (integer) 用户的前端认证方法。 参考 gui_access 的属性 关于用户组对象 列出可能的值。debug_mode - (integer) 表明是否为用户启用了调试功能。 可能的值: 0 - 禁用调试, 1 - 开启调试。users_status - (integer) 表示用户是否禁用。 可能的值: 0 - 用户可用, 1 - 用户禁用。 |
| selectMedias | query | 在medias 属性返回用户使用的媒体。 |
| selectMediatypes | query | 在 mediatypes 属性返回用户使用的媒体类型。 |
| selectUsrgrps | query | 在usrgrps 属性返回用户所属的组 |
| sortfield | string/array | 根据给定的属性对结果进行排序。 可能的值 : userid and alias. |
| countOutput | boolean | 这些参数对于所有的get方法是常见的,在 reference commentary中有详细描述. |
| editable | boolean | |
| excludeSearch | boolean | |
| filter | object | |
| limit | integer | |
| output | query | |
| preservekeys | boolean | |
| search | object | |
| searchByAny | boolean | |
| searchWildcardsEnabled | boolean | |
| sortorder | string/array | |
| startSearch | boolean | |
(integer/array)返回:
countOutput 参数被使用。(object) Parameters defining the desired output.
The method supports the following parameters.
| Parameter | Type | Description |
|---|---|---|
| mediaids | string/array | Return only users that use the given media. |
| mediatypeids | string/array | Return only users that use the given media types. |
| userids | string/array | Return only users with the given IDs. |
| usrgrpids | string/array | Return only users that belong to the given user groups. |
| getAccess | flag | Adds additional information about user permissions. Adds the following properties for each user: gui_access - (integer) user's frontend authentication method. Refer to the gui_access property of the user group object for a list of possible values.debug_mode - (integer) indicates whether debug is enabled for the user. Possible values: 0 - debug disabled, 1 - debug enabled.users_status - (integer) indicates whether the user is disabled. Possible values: 0 - user enabled, 1 - user disabled. |
| selectMedias | query | Return media used by the user in the medias property. |
| selectMediatypes | query | Return media types used by the user in the mediatypes property. |
| selectUsrgrps | query | Return user groups that the user belongs to in the usrgrps property. |
| sortfield | string/array | Sort the result by the given properties. Possible values are: userid and alias. |
| countOutput | boolean | These parameters being common for all get methods are described in detail in the reference commentary. |
| editable | boolean | |
| excludeSearch | boolean | |
| filter | object | |
| limit | integer | |
| output | query | |
| preservekeys | boolean | |
| search | object | |
| searchByAny | boolean | |
| searchWildcardsEnabled | boolean | |
| sortorder | string/array | |
| startSearch | boolean |
(integer/array) Returns either:
countOutput parameter has been used.检索所有已配置的用户。
Request:
{
"jsonrpc": "2.0",
"method": "user.get",
"params": {
"output": "extend"
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}Response:
{
"jsonrpc": "2.0",
"result": [
{
"userid": "1",
"alias": "Admin",
"name": "Zabbix",
"surname": "Administrator",
"url": "",
"autologin": "1",
"autologout": "0s",
"lang": "ru_RU",
"refresh": "0s",
"type": "3",
"theme": "default",
"attempt_failed": "0",
"attempt_ip": "",
"attempt_clock": "0",
"rows_per_page": "50"
},
{
"userid": "2",
"alias": "guest",
"name": "Default2",
"surname": "User",
"url": "",
"autologin": "0",
"autologout": "15m",
"lang": "en_GB",
"refresh": "30s",
"type": "1",
"theme": "default",
"attempt_failed": "0",
"attempt_ip": "",
"attempt_clock": "0",
"rows_per_page": "50"
}
],
"id": 1
}CUser::get() in frontends/php/include/classes/api/services/CUser.php.