Search in sources :

Example 1 with LDAPClient

use of lucee.runtime.net.ldap.LDAPClient in project Lucee by lucee.

the class Ldap method _doStartTag.

private int _doStartTag() throws NamingException, PageException, IOException, ClassException {
    // LDAPClient client=new LDAPClient(server,port,secureLevel,returnAsBinary,username,password,referral);
    LDAPClient client = new LDAPClient(server, port, returnAsBinary);
    if (secureLevel != LDAPClient.SECURE_NONE)
        client.setSecureLevel(secureLevel);
    if (username != null)
        client.setCredential(username, password);
    if (referral > 0)
        client.setReferral(referral);
    if (action.equals("add")) {
        required("LDAP", action, "attributes", attributes);
        required("LDAP", action, "dn", dn);
        client.add(dn, attributes, delimiter, separator);
    } else if (action.equals("delete")) {
        required("LDAP", action, "dn", dn);
        client.delete(dn);
    } else if (action.equals("modifydn")) {
        required("LDAP", action, "attributes", attributes);
        required("LDAP", action, "dn", dn);
        client.modifydn(dn, attributes);
    } else if (action.equals("modify")) {
        required("LDAP", action, "attributes", attributes);
        required("LDAP", action, "dn", dn);
        client.modify(dn, modifyType, attributes, delimiter, separator);
    } else if (action.equals("query")) {
        required("LDAP", action, "start", start);
        required("LDAP", action, "attributes", attributes);
        required("LDAP", action, "name", name);
        Query qry = client.query(attributes, scope, startrow, maxrows, timeout, sort, sortType, sortDirection, start, separator, filter);
        pageContext.setVariable(name, qry);
    } else
        throw new ApplicationException("invalid value for attribute action [" + action + "], valid values are [add,delete,modifydn,modify,query]");
    return SKIP_BODY;
}
Also used : LDAPClient(lucee.runtime.net.ldap.LDAPClient) ApplicationException(lucee.runtime.exp.ApplicationException) Query(lucee.runtime.type.Query)

Aggregations

ApplicationException (lucee.runtime.exp.ApplicationException)1 LDAPClient (lucee.runtime.net.ldap.LDAPClient)1 Query (lucee.runtime.type.Query)1