LDAP Plugin APIs
The LDAP plugin enables talking to LDAP servers. Once configured as an actor, each actor object will have the following functions.
Create(dn, arrayOfObjectClasses, attributes)
This API can be used to create an LDAP object in the directory represented by the actor.
Name | Type | Description |
---|---|---|
dn | String | Distinguished name of the object in LDAP format. |
arrayOfObjectClasses | String[] | Array of object classes to be set for the dn. |
attributes | Object | Key-value pairs with attribute and values to be set on the dn. |
Example
let user = "cn=spider man,ou=users,dc=example,dc=org";
let userAttrs = { cn: ["Peter", "John"], sn: "parker" };
let objClass = ["inetOrgPerson", "kopano-user"];
ldap1.Create(user, objClass, userAttrs);
Get(dn)
This API can be used to fetch one object from the LDAP directory given the distinguished name as dn
. The object returned has an Attributes
member object which can be used to read different attribute values.
Name | Type | Description |
---|---|---|
dn | String | The distinguished name of the object to fetch from the directory. |
Example
let user = "cn=spider man,ou=users,dc=example,dc=org";
let spiderMan = ldap1.Get(user);
GetObjList(base, filter, scope)
This API can be used for an LDAP search with the specified base
, filter,
and scope
. An array of objects with properties similar to the object returned by Get
is returned.
Name | Type | Description |
---|---|---|
base | String | The base of the search. |
filter | String | The LDAP filter for this search. |
scope | String | The scope of the search. Options - base , sub , or one . |
Example
let userList = ldap1.GetObjList(
"ou=users,dc=example,dc=org",
"(objectClass=inetOrgPerson)",
"sub"
);
Delete(dn)
This API can be used to delete an LDAP object specified by the distinguished name dn
.
Name | Type | Description |
---|---|---|
dn | String | The distinguished name of the object to delete from the directory. |
let user = "cn=spider man,ou=users,dc=example,dc=org";
ldap1.Delete(user);