object userdirectory.create(object/array userDirectory)
此方法用于创建新的用户目录。
此方法仅适用于Super admin(超级管理员)类型的用户。
(object/array)
要创建的用户目录。 该方法接受具有标准用户目录属性的用户目录。
(object)
返回一个对象,该对象包含在userdirectoryids
属性下创建的用户目录id。 返回的id的顺序与传递的用户目录的顺序匹配。
创建一个用户目录,以通过LDAP使用StartTLS对用户进行身份验证。 请注意,通过LDAP对用户进行身份验证时,LDAP authentication必须启用。
请求:
{
"jsonrpc": "2.0",
"method": "userdirectory.create",
"params": {
"idp_type": "1",
"name": "LDAP API server #1",
"host": "ldap://local.ldap",
"port": "389",
"base_dn": "ou=Users,dc=example,dc=org",
"bind_dn": "cn=ldap_search,dc=example,dc=org",
"bind_password": "ldapsecretpassword",
"search_attribute": "uid",
"start_tls": "1"
},
"id": 1
}
响应:
创建用户目录以通过LDAP对用户进行身份验证 (已启用JIT设置)。 请注意,通过LDAP对用户进行身份验证时,LDAP 身份认证必须开启。
请求:
{
"jsonrpc": "2.0",
"method": "userdirectory.create",
"params": {
"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": [
{
"name": "example.com",
"mediatypeid": "1",
"attribute": "[email protected]"
}
],
"provision_groups": [
{
"name": "*",
"roleid": "4",
"user_groups": [
{
"usrgrpid": "8"
}
]
},
{
"name": "Zabbix administrators",
"roleid": "2",
"user_groups": [
{
"usrgrpid": "7"
},
{
"usrgrpid": "8"
}
]
}
]
},
"id": 1
}
响应:
CUserDirectory::create() in ui/include/classes/api/services/CUserDirectory.php.