获取

描述

integer/array userdirectory.get(object parameters)

该方法用于根据给定的参数检索用户目录。

此方法仅适用于Super admin超级管理员类型的用户。

参数

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

该方法支持以下参数。

参数类型描述
userdirectoryidsID/array仅返回具有指定ID的用户目录。
selectUsrgrpsquery返回与用户目录关联的用户组usrgrps属性。

支持 count
selectProvisionMediaquery返回一个provision_media属性,其中包含与用户目录关联的媒介类型映射
selectProvisionGroupsquery返回provision_groups属性,其中包含与用户目录关联的预配置组映射
sortfieldstring/array按给定的属性对结果进行排序。

可能的值: name
filterobject仅返回与给定筛选器完全匹配的结果。

接受一个对象,其中键是属性名称,值是单个值或值数组。

支持的属性: userdirectoryid, idp_type, provision_status
searchobject返回与给定模式匹配的结果 (不区分大小写)。

接受一个对象,其中键是属性名称,值是要搜索的字符串。如果未提供其他选项,则将执行 LIKE “%…%”搜索。

支持的属性: name, description

SAML类型的用户目录的 namedescription 属性都为空。可以使用userdirectory.update操作更改这两个属性。
countOutputboolean参考说明中详细描述了所有 get方法的通用参数。
excludeSearchboolean
limitinteger
outputquery
preservekeysboolean
searchByAnyboolean
searchWildcardsEnabledboolean
sortorderstring/array
startSearchboolean

返回值

(integer/array) 返回两者其一:

  • 一个对象数组;
  • 检索对象的计数(使用 countOutput 参数时)。

示例

检索用户目录

检索具有其他属性的所有用户目录,这些属性显示与每个用户目录关联的介质类型映射和调配组映射。

请求:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "userdirectory.get",
  4. "params": {
  5. "output": "extend",
  6. "selectProvisionMedia": "extend",
  7. "selectProvisionGroups": "extend"
  8. },
  9. "id": 1
  10. }

响应:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": [
  4. {
  5. "userdirectoryid": "1",
  6. "idp_type": "2",
  7. "name": "",
  8. "provision_status": "1",
  9. "description": "",
  10. "group_name": "groups",
  11. "user_username": "",
  12. "user_lastname": "",
  13. "idp_entityid": "http://example.com/simplesaml/saml2/idp/metadata.php",
  14. "sso_url": "http://example.com/simplesaml/saml2/idp/SSOService.php",
  15. "slo_url": "",
  16. "username_attribute": "uid",
  17. "sp_entityid": "zabbix",
  18. "nameid_format": "",
  19. "sign_messages": "0",
  20. "sign_assertions": "0",
  21. "sign_authn_requests": "0",
  22. "sign_logout_requests": "0",
  23. "sign_logout_responses": "0",
  24. "encrypt_nameid": "0",
  25. "encrypt_assertions": "0",
  26. "scim_status": "1",
  27. "provision_media": [
  28. {
  29. "userdirectory_mediaid": "1",
  30. "name": "example.com",
  31. "mediatypeid": "1",
  32. "attribute": "[email protected]",
  33. "active": "0",
  34. "severity": "63",
  35. "period": "1-7,00:00-24:00"
  36. }
  37. ],
  38. "provision_groups": [
  39. {
  40. "name": "*",
  41. "roleid": "1",
  42. "user_groups": [
  43. {
  44. "usrgrpid": "13"
  45. }
  46. ]
  47. }
  48. ]
  49. },
  50. {
  51. "userdirectoryid": "2",
  52. "idp_type": "1",
  53. "name": "AD server",
  54. "provision_status": "1",
  55. "description": "",
  56. "host": "host.example.com",
  57. "port": "389",
  58. "base_dn": "DC=zbx,DC=local",
  59. "search_attribute": "sAMAccountName",
  60. "bind_dn": "CN=Admin,OU=Users,OU=Zabbix,DC=zbx,DC=local",
  61. "start_tls": "0",
  62. "search_filter": "",
  63. "group_basedn": "OU=Zabbix,DC=zbx,DC=local",
  64. "group_name": "CN",
  65. "group_member": "member",
  66. "group_filter": "(%{groupattr}=CN=%{ref},OU=Users,OU=Zabbix,DC=zbx,DC=local)",
  67. "group_membership": "",
  68. "user_username": "givenName",
  69. "user_lastname": "sn",
  70. "user_ref_attr": "CN",
  71. "provision_media": [
  72. {
  73. "userdirectory_mediaid": "2",
  74. "name": "example.com",
  75. "mediatypeid": "1",
  76. "attribute": "[email protected]",
  77. "active": "0",
  78. "severity": "63",
  79. "period": "1-7,00:00-24:00"
  80. }
  81. ],
  82. "provision_groups": [
  83. {
  84. "name": "*",
  85. "roleid": "4",
  86. "user_groups": [
  87. {
  88. "usrgrpid": "8"
  89. }
  90. ]
  91. },
  92. {
  93. "name": "Zabbix administrators",
  94. "roleid": "2",
  95. "user_groups": [
  96. {
  97. "usrgrpid": "7"
  98. },
  99. {
  100. "usrgrpid": "8"
  101. }
  102. ]
  103. }
  104. ]
  105. },
  106. {
  107. "userdirectoryid": "3",
  108. "idp_type": "1",
  109. "name": "LDAP API server #1",
  110. "provision_status": "0",
  111. "description": "",
  112. "host": "ldap://local.ldap",
  113. "port": "389",
  114. "base_dn": "ou=Users,dc=example,dc=org",
  115. "search_attribute": "uid",
  116. "bind_dn": "cn=ldap_search,dc=example,dc=org",
  117. "start_tls": "1",
  118. "search_filter": "",
  119. "group_basedn": "",
  120. "group_name": "",
  121. "group_member": "",
  122. "group_filter": "",
  123. "group_membership": "",
  124. "user_username": "",
  125. "user_lastname": "",
  126. "user_ref_attr": "",
  127. "provision_media": [],
  128. "provision_groups": []
  129. }
  130. ],
  131. "id": 1
  132. }

参考

来源

CUserDirectory::get() in ui/include/classes/api/services/CUserDirectory.php.