If you feel some confusion about any thing or if you do not find what you are looking for, please inform us so that we can improve our documentation accordingly. docs@aspfusion.net

AdvLDAP

The component allows you to perform all basic LDAP operations on LDAP (Lightweight Directory Access Protocol) directory servers like the Netscape Directory Server. Access to the component can also be turned on at web basis like all other ASPFusion components. It provides the following operations.

  1. Complete basic LDAP server operations, such as Add, Modify, ModifyDN and Delete.

  2. Along with these operations it provides Query the LDAP entries giving the search criteria and can sort the list in ascending, descending and case sensitive, case insensitive order given sorting criteria.

<%set Obj = Server.CreateObject("AdvLDAP.LDAP")%> 

AdvLDAP Properties 

Property

Description

Attributes It is a semicolon ‘;’ separated list of attributes against which the values should be retrieved from the LDAP server
Example:
<%Obj.Attributes = “cn;sn;mail;telephonenumber;l”%>

ErrorReason

Reports any errors that occur during the request
Example:
<%if Obj.IsError = 1 then
        Response.Write Obj.ErrorReason
else
        No Error
end if %>

Filter

It is a filter that defines the conditions that must be fulfilled in order for the search to match a given entry. Attributes are referenced in the form: “Attribute operator value”. Its default value is “objectclass = *
Example:
<%Obj.Filter = “sn = Aasher”%>

FilterFile

Specifies the name of the file that contains the filter string specification. If filter string is specified in the filter file then the ‘Filter’ parameter will be ignored
Example:

<%Obj.FilterFile = “c:\AdvLDAP\filterStr.txt”%>

IsError

Returns 1 if any error occur during the request otherwise 0
Example:
<%if Obj.IsError = 1 then
        Error
else
        No Error
end if %>

MaxRows

It is the maximum number of entries to be returned as a result of a search. If not specified then all entries are returned as default
Example:
<%Obj.MaxRows = 5%>

Password

Password corresponds to the user name
Example:
<%Obj.Password = “secret”%>

Port

Optional. If not specified then default port 389 is used for communicating with LDAP server
Example:
<%Obj.Port = 889%>

Scope

Specifies the scope of the search from the entry specified in the DN property. Valid values are
OneLevel -- (default) Searches all entries one level beneath the entry specified in the START attribute. 
Base -- Searches only the entry specified in the START attribute. 
Subtree -- Searches the entry specified in the START attribute as well all entries at all levels beneath it
Example:
<%Obj.Scope = “Base”%>

ServerName

Required. Host name or IP address of the LDAP server  
Example:
<%Obj.ServerName = “LocalHost”%>

Sort

Indicate the attribute to sort query result by
Example:
<%Obj.Sort = “cn”%>

SortAscending

Specify sorting order of the Query results. Valid values are
TRUE -- (default) for ascending
FALSE -- for descending
Example:
<%Obj.SortAscending = false%>

SortCasesensitive

Specify sorting mechanism of the Query results. Valid values are
TRUE -- (default) case sensitive

FALSE --
case insensitive
Example:
<%Obj.SortCasesensitive = false%>

Timeout

It is the maximum time (in seconds) allowed for a search. If not specified then default value is 60
Example:
<%Obj.Timeout = 60%>

UserName

User name required for accessing the server. If no specified then LDAP connection will be anonymous
Example:
<%Obj.Username = “uid = admin, o = Advcomm”%
>

AdvLDAP Methods 

Method 

Parameter

Return Value

Description

Add

None

 None

Add entries to the LDAP Server
Example:
<%
Obj.Add()%>

AttributeAdd

AttributeName
AttributeValue
ValueSize

 None

The method is used to set the value of attributes of the entry, which is to be added in the LDAP Server. To set more than one attributes call the method multiple times. AttributeName should contain the name of the attribute. AttributeValue should contain the value of the attribute. If the attribute value is not binary then the ValueSize should be –1 else it will be the size of value in bytes
Example:
<%Obj.AttributeAdd
AttributeName, AttributeValue, ValueSize%>

AttributeModify

AttributeName
AttributeValue
ValueSize
AddFlg

None

The method is used to set the value of attributes of the entry, which is to be modified in the LDAP Server. To set more than one attributes call the method multiple times. AttributeName should contain the name of the attribute. AttributeValue should contain the value of the attribute. If the attribute value is not binary then the ValueSize should be –1 else it will be the size of value in bytes. If new value is to be replaced by the previous values then AddFlg must be FALSE else it must be TRUE
Example:
<%Obj.AttributeModify
AttributeName, AttributeValue, ValueSize, AddFlg%>

Delete

  None

None

Deletes entries from LDAP server
Example:
<%Obj.Delete()%>

DN

Attribute
Value

None

Specifies the distinguished name of the entry on LDAP server. For going in depth in the directory tree call the method multiple time with specifying the Attribute from top to the bottom
Example:
<%Obj.DN Attribute, Value%>
<%Obj.DN Attribute, Value%>

Modify None None

Modifies entries on LDAP Server with the exception of the distinguished name (DN) attribute
Example:
<%Obj.Modify()%>

ModifyDN None None

Modifies the distinguished name attribute for LDAP entries on LDAP server
Example:
<%Obj.ModifyDN()%>

NewRDN

Attribute
Value

None

Specifies the relative distinguished name of the entry on LDAP server. It must be the leaf in the directory tree
Example:
<%Obj.NewRDN
Attribute, Value%>

Query None Array of objects

Returns entries information on the basis of some search criteria.
Example:
<%set Result = Obj.Query()
dim cols, rows, Arr()
cols = 0
rows = 0
for each Member in Result
      cols = cols + 1
      if (cols = 1) then 
          set
Links = Member.ValuesList()
          for each item in Links 
                 rows = rows + 1
          next
          set Links = nothing 
      
end if 
next
redim
Arr(cols, rows)
c1 = 0
for each Member in Result 
       r1 = 0 
       set Lnks = Member.ValuesList()
      
for each Item in Lnks 
             
val = ""
             
itm = Item.Value
             
for i = 0 to ubound(itm)
                   
val = val & itm(i)
                    if (i <> ubound(itm)) then 
                       
val = val & ", " 
                   
end if 
             
next 
              Arr(c1,r1) = val 
              r1 = r1 + 1 
       next 
       set Lnks = nothing
      
c1 = c1+1 
next
set
Result = nothing%>

Back

Copyright © 2000, Advanced Communications