A simple example of checking if a user is a member of a group with LDAP. There is a small invisible JavaBean - LDAPIsMember. JavaScript fetches user-entered values and looks for the user as a member of the named group, in the specified directory, by setting properties on LDAPIsMember and calling its isMember() method.

An example of an entry to test is:
Group name: cn=Directory Administrators, ou=Groups, o=Airius.com
Member name: uid=hmiller, ou=People, o=Airius.com
Host:
Port:
Group name:
Member name:

The JavaScript code to do this is as follows:

    check = new netscape.ldap.beans.LDAPIsMember();
    check.setHost( document.input.host.value );
    check.setPort( parseInt(document.input.port.value) );
    check.setGroup( document.input.group.value );
    check.setMember( document.input.member.value );
    if ( check.isMember() )
        alert( document.input.member.value " is a member of " +
                document.input.group.value );
    else
        showError();

or you can pass all parameters in the call itself:

    check = new netscape.ldap.beans.LDAPIsMember();
    if ( check.isMember( document.input.host.value,
                         parseInt(document.input.port.value),
                         "", "",
                         document.input.group.value,
                         document.input.member.value ) )
        ...