这是原厂英文文档的翻译页面. 欢迎帮助我们 完善文档.
2022 Zabbix中国峰会
2022 Zabbix中国峰会

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.

Parameter Type Description
userdirectoryids string/array Return only user directory with the given IDs.
selectUsrgrps query Return a usrgrps property with user groups associated with user directory.

Supports count.
sortfield string/array Sort the result by the given properties.

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

Possible values are: userdirectoryid, host, name.
search object Return results that match the given wildcard search (case-insensitive).

Possible values are: base_dn, bind_dn, description, host, name, search_attribute, search_filter.
countOutput boolean These parameters being common for all get methods are described in detail in the reference commentary.
excludeSearch boolean
limit integer
output query
preservekeys boolean
searchByAny boolean
searchWildcardsEnabled boolean
sortorder string/array
startSearch boolean

返回值

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

  • 一个对象数组;
  • 如果使用了'countOutput'参数,则对检索对象进行计数。

示例

Retrieving user directories

Retrieve all user directories with additional property with count of user groups where user directory is used.

Request:

{
           "jsonrpc": "2.0",
           "method": "userdirectory.get",
           "params": {
               "output": "extend",
               "selectUsrgrps": "count"
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": [
               {
                   "userdirectoryid": "2",
                   "name": "API user directory #1",
                   "description": "",
                   "host": "127.0.0.1",
                   "port": "389",
                   "base_dn": "ou=Users,dc=example,dc=org",
                   "bind_dn": "cn=ldap_search,dc=example,dc=org",
                   "search_attribute": "uid",
                   "start_tls": "0",
                   "search_filter": "",
                   "usrgrps": "5"
               }
           ],
           "id": 1
       }

See also

Source

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