This is a translation of the original English documentation page. Help us make it better.

userdirectory.create

Beschrijving

object userdirectory.create(object/array userDirectory)

Deze methode maakt het mogelijk om nieuwe gebruikersmappen te maken.

Deze methode is alleen beschikbaar voor gebruikers van het type Super admin.

Parameters

(object/array) User directories to create.

The method accepts user directories with the standard user directory properties.

Retourwaarden

(object) Geeft een object terug met de ID's van de aangemaakte gebruikersmappen onder de eigenschap userdirectoryids. De volgorde van de teruggegeven ID's komt overeen met de volgorde van de doorgegeven gebruikersmappen.

Voorbeelden

Creating a user directory

Create a user directory to authenticate users with StartTLS over LDAP. Note that to authenticate users over LDAP, LDAP authentication must be enabled.

Request:

{
           "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
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "userdirectoryids": [
                   "3"
               ]
           },
           "id": 1
       }
Gebruikersdirectory aanmaken (JIT-provisioning ingeschakeld)

Maak een gebruikersdirectory aan om gebruikers te authenticeren via LDAP (met JIT-provisioning ingeschakeld). Merk op dat om gebruikers via LDAP te authenticeren, LDAP-authenticatie ingeschakeld moet zijn.

Aanvraag:

{
           "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=Beheerder,OU=Gebruikers,OU=Zabbix,DC=zbx,DC=local",
                   "start_tls": "0",
                   "search_filter": "",
                   "group_basedn": "OU=Zabbix,DC=zbx,DC=local",
                   "group_name": "CN",
                   "group_member": "lid",
                   "group_filter": "(%{groupattr}=CN=%{ref},OU=Gebruikers,OU=Zabbix,DC=zbx,DC=local)",
                   "group_membership": "",
                   "user_username": "voornaam",
                   "user_lastname": "achternaam",
                   "user_ref_attr": "CN",
                   "provision_media": [
                       {
                           "name": "voorbeeld.com",
                           "mediatypeid": "1",
                           "attribute": "[email protected]"
                       }
                   ],
                   "provision_groups": [
                       {
                           "name": "*",
                           "roleid": "4",
                           "user_groups": [
                               {
                                   "usrgrpid": "8"
                               }
                           ]
                       },
                       {
                           "name": "Zabbix-beheerders",
                           "roleid": "2",
                           "user_groups": [
                               {
                                   "usrgrpid": "7"
                               },
                               {
                                   "usrgrpid": "8"
                               }
                           ]
                       }
                   ]
               },
           "id": 1
       }

Reactie:

{
           "jsonrpc": "2.0",
           "result": {
               "userdirectoryids": [
                   "2"
               ]
           },
           "id": 1
       }

Bron

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