LDAP requests

Last modified by superadmin on 24.01.2017

LDAP requests react similar to data base requests or data sources. They serve to determine dynamic data of a LDAP server. Here is next to the filtering via an LDAP-Query also the constraint of the return values to defined attributes available. 

Creating LDAP query

  • Give the LDAP query a name and optionally a description.
  • Use the client's LDAP connection or select another LDAP connection.
  • Enter the base DND for the query. This is the root path for the LDAP search.
  • Enter the LDAP query using the LDAP filter syntax, see here for a tutorial). You may also use placeholders (?) that will be replaced with values from a GET request for this LDAP query, see below.
  • Optionally, enter a list of attributes to filter for. The query will return only those attributes, filtered on the server. When no parameters are specified, all attributes will be returned.

Using LDAP queries

LDAP queries can be accessed via a GET request. This allows you to access LDAP queries from a from via JavaScript.

http://<server>/formcycle/datenabfrageldap

The following URL parameters are available:

Name of the parameterDescriptionRequired
nameThe name of the LDAP request.Yes
mandantNameThe name of the client to whom the LDAP query belongs to.Yes, when projektId was not specified.
projektIdThe ID of the form. The form ID can be accessed via the JavaScript object XFC_METADATA.currentProject.id.Yes, when mandantName was not specified.
queryParameterWhen the LDAP query contains placeholders in the form of question marks ?, a list of parameters must be supplied for each placeholder. The list items are separated with the delimiter as defined by the URL parameter delimiter.No
delimiterThe delimiter for the placeholder values, see queryParameter. Defaults to a comma ,No

When you want to call an LDAP query from a form, use the URL provided by the JavaScript object XFC_METADATA. The LDAP query URL can be accessed via XFC_METADATA.urls.datasource_ldap.

The LDAP queries returns a JSON object that can be parsed with JSON.parse(...)

Example for LDAP query

Assume the following query has been created and named MyQuery.

((distinguishedName=?,?)

You will need to provide two values for the the two placeholders (question marks). Send a GET request to the following URL to run the LDAP query:

http://<server>/formcycle/datenabfrageldap?name=MyQuery&mandantName=MyClient&queryParameter=Value,1;Value,2&delimiter=;

The following code can be used to run the LDAP query via AJAX from a form:

function ldapQuery(name, queryParameter, delimiter, callback) {
    $.ajax({
        url: XFC_METADATA.urls.dataquery_ldap,
        method: 'GET',
        async: true,
        cache: false,
        dataType: 'json',
        data: {
            name: name,
            mandantName: XFC_METADATA.currentClient.name,
            queryParameter: queryParameter,
            delimiter: delimiter || ','
        }
    }).success(callback);
}
Tags:
Created by superadmin on 08.02.2016
Translated into en by superadmin on 08.07.2016
  
Copyright 2000-2016