userdirectory.get

Description

integer/array userdirectory.get(object parameters)

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

This method is only available to Super admin user types.

Parameters

(object) Parameters defining the desired output.

The method supports the following parameters.

ParameterTypeDescription
userdirectoryidsstring/arrayReturn only user directories with the given IDs.
selectUsrgrpsqueryReturn a usrgrps property with user groups associated with a user directory.

Supports count.
selectProvisionMediaqueryReturn a provision_media property with media type mappings associated with a user directory.
selectProvisionGroupsqueryReturn a provision_groups property with provisioning groups mappings associated with a user directory.
sortfieldstring/arraySort the result by the given properties.

Possible values: name, host.
filterobjectReturn only those results that exactly match the given filter.

Accepts an object, where the keys are property names, and the values are either a single value or an array of values.

Supported keys: userdirectoryid, idp_type, provision_status.
searchobjectReturn results that match the given wildcard search (case-insensitive).

Possible values: name, description.

User directory of type SAML will have an empty value for both name and description fields. Both fields can be changed with userdirectory.update operation.
countOutputbooleanThese parameters being common for all get methods are described in detail in the reference commentary.
excludeSearchboolean
limitinteger
outputquery
preservekeysboolean
searchByAnyboolean
searchWildcardsEnabledboolean
sortorderstring/array
startSearchboolean

Return values

(integer/array) Returns either:

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

Examples

Retrieving user directories

Retrieve all user directories with additional properties that display media type mappings and provisioning groups mappings associated with each user directory.

Request:

  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. }

Response:

  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. "name": "example.com",
  30. "mediatypeid": "1",
  31. "attribute": "[email protected]"
  32. }
  33. ],
  34. "provision_groups": [
  35. {
  36. "name": "*",
  37. "roleid": "1",
  38. "user_groups": [
  39. {
  40. "usrgrpid": "13"
  41. }
  42. ]
  43. }
  44. ]
  45. },
  46. {
  47. "userdirectoryid": "2",
  48. "idp_type": "1",
  49. "name": "AD server",
  50. "provision_status": "1",
  51. "description": "",
  52. "host": "host.example.com",
  53. "port": "389",
  54. "base_dn": "DC=zbx,DC=local",
  55. "search_attribute": "sAMAccountName",
  56. "bind_dn": "CN=Admin,OU=Users,OU=Zabbix,DC=zbx,DC=local",
  57. "start_tls": "0",
  58. "search_filter": "",
  59. "group_basedn": "OU=Zabbix,DC=zbx,DC=local",
  60. "group_name": "CN",
  61. "group_member": "member",
  62. "group_filter": "(%{groupattr}=CN=%{ref},OU=Users,OU=Zabbix,DC=zbx,DC=local)",
  63. "group_membership": "",
  64. "user_username": "givenName",
  65. "user_lastname": "sn",
  66. "user_ref_attr": "CN",
  67. "provision_media": [
  68. {
  69. "name": "example.com",
  70. "mediatypeid": "1",
  71. "attribute": "[email protected]"
  72. }
  73. ],
  74. "provision_groups": [
  75. {
  76. "name": "*",
  77. "roleid": "4",
  78. "user_groups": [
  79. {
  80. "usrgrpid": "8"
  81. }
  82. ]
  83. },
  84. {
  85. "name": "Zabbix administrators",
  86. "roleid": "2",
  87. "user_groups": [
  88. {
  89. "usrgrpid": "7"
  90. },
  91. {
  92. "usrgrpid": "8"
  93. }
  94. ]
  95. }
  96. ]
  97. },
  98. {
  99. "userdirectoryid": "3",
  100. "idp_type": "1",
  101. "name": "LDAP API server #1",
  102. "provision_status": "0",
  103. "description": "",
  104. "host": "ldap://local.ldap",
  105. "port": "389",
  106. "base_dn": "ou=Users,dc=example,dc=org",
  107. "search_attribute": "uid",
  108. "bind_dn": "cn=ldap_search,dc=example,dc=org",
  109. "start_tls": "1",
  110. "search_filter": "",
  111. "group_basedn": "",
  112. "group_name": "",
  113. "group_member": "",
  114. "group_filter": "",
  115. "group_membership": "",
  116. "user_username": "",
  117. "user_lastname": "",
  118. "user_ref_attr": "",
  119. "provision_media": [],
  120. "provision_groups": []
  121. }
  122. ],
  123. "id": 1
  124. }

See also

Source

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