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 directory with the given IDs.
selectUsrgrpsqueryReturn a usrgrps property with user groups associated with user directory.

Supports count.
sortfieldstring/arraySort the result by the given properties.

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

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

Possible values are: base_dn, bind_dn, description, host, name, search_attribute, search_filter.
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

返回值

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

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

示例

Retrieving user directories

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

Request:

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

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": [
  4. {
  5. "userdirectoryid": "2",
  6. "name": "API user directory #1",
  7. "description": "",
  8. "host": "127.0.0.1",
  9. "port": "389",
  10. "base_dn": "ou=Users,dc=example,dc=org",
  11. "bind_dn": "cn=ldap_search,dc=example,dc=org",
  12. "search_attribute": "uid",
  13. "start_tls": "0",
  14. "search_filter": "",
  15. "usrgrps": "5"
  16. }
  17. ],
  18. "id": 1
  19. }

See also

Source

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