usergroup.get

说明

integer/array usergroup.get(object parameters)

该方法允许根据给定的参数检索用户组。

Description

integer/array usergroup.get(object parameters)

The method allows to retrieve user groups according to the given parameters.

参数

(object) 定义所需输出的参数。

该方法支持以下参数。

属性 类说明
statusinteger只返回具有给定状态的用户组。

请参阅用户组页面以获取支持的状态列表。
useridsstring/array只返回包含给定用户的用户组。
usrgrpidsstring/array只返回具有给定ID的用户组。
with_gui_accessinteger只返回具有给定前端身份验证方法的用户组。

有关支持的方法的列表,请参阅 用户组页面
selectTagFiltersqueryReturn user group tag based permissions in the tag_filters property.

It has the following properties:
groupid - (string) ID of the host group;
tag - (string) tag name;
value - (string) tag value.
selectUsersquery在“users”属性中返回用户组中的用户。
selectRightsquery在“权限”属性中返回用户组权限。

它具有以下属性:
权限 - (整数)访问级别到主机组;
id - (string)主机组的ID。

有关主机组的访问级别列表,请参阅用户组页面
limitSelectsinteger限制子选择返回的记录数。
sortfieldstring/array按照给定的属性对结果进行排序。

可能的值为:usrgrpidname
countOutputflag参考文献中详细描述了所有“获得”方法的常用参数。.
editableboolean
excludeSearchflag
filterobject
limitinteger
outputquery
preservekeysflag
searchobject
searchByAnyboolean
searchWildcardsEnabledboolean
sortorderstring/array
startSearchflag

Parameters

(object) Parameters defining the desired output.

The method supports the following parameters.

ParameterTypeDescription
statusintegerReturn only user groups with the given status.

Refer to the user group page for a list of supported statuses.
useridsstring/arrayReturn only user groups that contain the given users.
usrgrpidsstring/arrayReturn only user groups with the given IDs.
with_gui_accessintegerReturn only user groups with the given frontend authentication method.

Refer to the user group page for a list of supported methods.
selectTagFiltersqueryReturn user group tag based permissions in the tag_filters property.

It has the following properties:
groupid - (string) ID of the host group;
tag - (string) tag name;
value - (string) tag value.
selectUsersqueryReturn the users from the user group in the users property.
selectRightsqueryReturn user group rights in the rights property.

It has the following properties:
permission - (integer) access level to the host group;
id - (string) ID of the host group.

Refer to the user group page for a list of access levels to host groups.
limitSelectsintegerLimits the number of records returned by subselects.
sortfieldstring/arraySort the result by the given properties.

Possible values are: usrgrpid, name.
countOutputbooleanThese parameters being common for all get methods are described in detail in the reference commentary.
editableboolean
excludeSearchboolean
filterobject
limitinteger
outputquery
preservekeysboolean
searchobject
searchByAnyboolean
searchWildcardsEnabledboolean
sortorderstring/array
startSearchboolean

返回值

(integer/array) 返回:

  • 一组对象;
  • 如果已经使用“countOutput”参数,则检索到的对象的计数。

Return values

(integer/array) Returns either:

  • an array of objects;
  • the count of retrieved objects, if the countOutput parameter has been used.

示例

检索已启用的用户组

检索所有已启用的用户组。

Examples

Retrieving enabled user groups

Retrieve all enabled user groups.

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "usergroup.get",
  4. "params": {
  5. "output": "extend",
  6. "status": 0
  7. },
  8. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  9. "id": 1
  10. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": [
  4. {
  5. "usrgrpid": "7",
  6. "name": "Zabbix administrators",
  7. "gui_access": "0",
  8. "users_status": "0",
  9. "debug_mode": "1"
  10. },
  11. {
  12. "usrgrpid": "8",
  13. "name": "Guests",
  14. "gui_access": "0",
  15. "users_status": "0",
  16. "debug_mode": "0"
  17. },
  18. {
  19. "usrgrpid": "11",
  20. "name": "Enabled debug mode",
  21. "gui_access": "0",
  22. "users_status": "0",
  23. "debug_mode": "1"
  24. },
  25. {
  26. "usrgrpid": "12",
  27. "name": "No access to the frontend",
  28. "gui_access": "2",
  29. "users_status": "0",
  30. "debug_mode": "0"
  31. },
  32. {
  33. "usrgrpid": "14",
  34. "name": "Read only",
  35. "gui_access": "0",
  36. "users_status": "0",
  37. "debug_mode": "0"
  38. },
  39. {
  40. "usrgrpid": "18",
  41. "name": "Deny",
  42. "gui_access": "0",
  43. "users_status": "0",
  44. "debug_mode": "0"
  45. }
  46. ],
  47. "id": 1
  48. }

参见

来源

CUserGroup::get() in frontends/php/include/classes/api/services/CUserGroup.php.