获取
描述
integer/array userdirectory.get(object parameters)
该方法用于根据给定的参数检索用户目录。
此方法仅适用于Super admin超级管理员类型的用户。
参数
定义所需输出的(object)
参数。
该方法支持以下参数。
参数 | 类型 | 描述 |
---|---|---|
userdirectoryids | ID/array | 仅返回具有指定ID的用户目录。 |
selectUsrgrps | query | 返回与用户目录关联的用户组的 usrgrps 属性。支持 count 。 |
selectProvisionMedia | query | 返回一个provision_media 属性,其中包含与用户目录关联的媒介类型映射。 |
selectProvisionGroups | query | 返回provision_groups 属性,其中包含与用户目录关联的预配置组映射。 |
sortfield | string/array | 按给定的属性对结果进行排序。 可能的值: name 。 |
filter | object | 仅返回与给定筛选器完全匹配的结果。 接受一个对象,其中键是属性名称,值是单个值或值数组。 支持的属性: userdirectoryid , idp_type , provision_status 。 |
search | object | 返回与给定模式匹配的结果 (不区分大小写)。 接受一个对象,其中键是属性名称,值是要搜索的字符串。如果未提供其他选项,则将执行 LIKE “%…%” 搜索。支持的属性: name , description 。SAML类型的用户目录的 name 和 description 属性都为空。可以使用userdirectory.update 操作更改这两个属性。 |
countOutput | boolean | 参考说明中详细描述了所有 get 方法的通用参数。 |
excludeSearch | boolean | |
limit | integer | |
output | query | |
preservekeys | boolean | |
searchByAny | boolean | |
searchWildcardsEnabled | boolean | |
sortorder | string/array | |
startSearch | boolean |
返回值
(integer/array)
返回两者其一:
- 一个对象数组;
- 检索对象的计数(使用
countOutput
参数时)。
示例
检索用户目录
检索具有其他属性的所有用户目录,这些属性显示与每个用户目录关联的介质类型映射和调配组映射。
请求:
{
"jsonrpc": "2.0",
"method": "userdirectory.get",
"params": {
"output": "extend",
"selectProvisionMedia": "extend",
"selectProvisionGroups": "extend"
},
"id": 1
}
响应:
{
"jsonrpc": "2.0",
"result": [
{
"userdirectoryid": "1",
"idp_type": "2",
"name": "",
"provision_status": "1",
"description": "",
"group_name": "groups",
"user_username": "",
"user_lastname": "",
"idp_entityid": "http://example.com/simplesaml/saml2/idp/metadata.php",
"sso_url": "http://example.com/simplesaml/saml2/idp/SSOService.php",
"slo_url": "",
"username_attribute": "uid",
"sp_entityid": "zabbix",
"nameid_format": "",
"sign_messages": "0",
"sign_assertions": "0",
"sign_authn_requests": "0",
"sign_logout_requests": "0",
"sign_logout_responses": "0",
"encrypt_nameid": "0",
"encrypt_assertions": "0",
"scim_status": "1",
"provision_media": [
{
"userdirectory_mediaid": "1",
"name": "example.com",
"mediatypeid": "1",
"attribute": "[email protected]",
"active": "0",
"severity": "63",
"period": "1-7,00:00-24:00"
}
],
"provision_groups": [
{
"name": "*",
"roleid": "1",
"user_groups": [
{
"usrgrpid": "13"
}
]
}
]
},
{
"userdirectoryid": "2",
"idp_type": "1",
"name": "AD server",
"provision_status": "1",
"description": "",
"host": "host.example.com",
"port": "389",
"base_dn": "DC=zbx,DC=local",
"search_attribute": "sAMAccountName",
"bind_dn": "CN=Admin,OU=Users,OU=Zabbix,DC=zbx,DC=local",
"start_tls": "0",
"search_filter": "",
"group_basedn": "OU=Zabbix,DC=zbx,DC=local",
"group_name": "CN",
"group_member": "member",
"group_filter": "(%{groupattr}=CN=%{ref},OU=Users,OU=Zabbix,DC=zbx,DC=local)",
"group_membership": "",
"user_username": "givenName",
"user_lastname": "sn",
"user_ref_attr": "CN",
"provision_media": [
{
"userdirectory_mediaid": "2",
"name": "example.com",
"mediatypeid": "1",
"attribute": "[email protected]",
"active": "0",
"severity": "63",
"period": "1-7,00:00-24:00"
}
],
"provision_groups": [
{
"name": "*",
"roleid": "4",
"user_groups": [
{
"usrgrpid": "8"
}
]
},
{
"name": "Zabbix administrators",
"roleid": "2",
"user_groups": [
{
"usrgrpid": "7"
},
{
"usrgrpid": "8"
}
]
}
]
},
{
"userdirectoryid": "3",
"idp_type": "1",
"name": "LDAP API server #1",
"provision_status": "0",
"description": "",
"host": "ldap://local.ldap",
"port": "389",
"base_dn": "ou=Users,dc=example,dc=org",
"search_attribute": "uid",
"bind_dn": "cn=ldap_search,dc=example,dc=org",
"start_tls": "1",
"search_filter": "",
"group_basedn": "",
"group_name": "",
"group_member": "",
"group_filter": "",
"group_membership": "",
"user_username": "",
"user_lastname": "",
"user_ref_attr": "",
"provision_media": [],
"provision_groups": []
}
],
"id": 1
}
参考
来源
CUserDirectory::get() in ui/include/classes/api/services/CUserDirectory.php.