Focal Point
query LDAP for additional information

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/1671001841

January 10, 2006, 06:32 PM
Joan Williamson-Kelly
query LDAP for additional information
Does anyone know if there's a way to query our corporate LDAP database for information like username, address, etc. through a WebFOCUS focexec?
January 11, 2006, 06:28 AM
rubenibi
I think LDAP exists precisely for avoiding the necessity of playing with tables for login/pass questions....

Anyway, normally, LDAP in most of the cases is in another PC, and users neither developers can access directly to its BBDD, via SQL neither WebFOCUS.

Why can access LDAP tables?



____________________________________________
Ruben Rueda
Consultant
Information Builders Iberica

Web: http://www.eruben.biz

Prod: WF 5.3.4 @ Red Hat Enterprise Linux ES 3 (Taroon Update 6) w/Oracle 9i
Test: WF 5.3.3 @ SUN Solaris 7 w/Oracle 8i
January 11, 2006, 02:00 PM
N.Selph
We have a nightly extract of selected data from LDAP into XML files, which I query from IBI. I don't think you can access it directly.


(Prod: WebFOCUS 7.7.03: Win 2008 & AIX hub/Servlet Mode; sub: AS/400 JDE; mostly Self Serve; DBs: Oracle, JDE, SQLServer; various output formats)
February 23, 2006, 12:57 PM
db
N.Selp, how is that set up. I need 2 attributes from LDAP to create a report in WebFocus.
February 27, 2006, 03:03 PM
dhagen
You could always get a JDBC/LDAP Bridge (http://www.octetstring.com/support/jdbcldapdriver/GettingStarted.php)
This would allow you to read your LDAP environment like any database via a JDBC connection in WF.

I haven't done it so I cannot verify that it works, however, if you do this, let us know how it worked out!


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
February 27, 2006, 03:39 PM
TexasStingray
If you do not have a licnese for a JDBC Adapter you can contact your local branch




Scott

All:

Thanks for your posts.

Fate actually helped me out in the end.

Some other folks in our organization were able to use Cold Fusion to query our Corporate LDAP database and get back values to pass in as variables to the WFSERVLET for use in WebFOCUS.

It's working quite nicely.
Joan,would you mind sharing the steps to configure or set that up. I need to pull some info from our corporate database to create variables.

Thanks
For the record, WF 7.1.1 and up has LDAP as a data adaptor. You can now query your LDAP environment with the TABLE command.


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
Thanks. We're still running 5.3 and have no plans to upgrade, so I guess I'm out of luck.
db,

How about calling a visual basic script to pull your variables? I use this to get full names and other items -

Set objArgs = Wscript.Arguments

if objArgs.Count = 0 then 
 Wscript.Echo  "sAMAccountName argument required. ""Jerry"" or ""*"" or ""J*"" or etc.."
 WScript.Quit (1)
End If

sam = objArgs(0)

Set oShell = CreateObject( "WScript.Shell" )
domain =oShell.ExpandEnvironmentStrings("%USERDOMAIN%")
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")

objConnection.Provider = "ADsDSOOBject"
objConnection.Open "Active Directory Provider"

Set FileSystem = WScript.CreateObject("Scripting.FileSystemObject")
Set OutPutFile = FileSystem.CreateTextFile("username.txt", True) 

Set objCommand.ActiveConnection = objConnection
Set objRootDSE = GetObject("LDAP://RootDSE")

'Get domain
strDNSDomain = objRootDSE.Get("defaultNamingContext")
strBase = "<LDAP://" & strDNSDomain & ">"

'Define the filter elements
strFilter = "(&(objectCategory=person)(objectClass=user)(sAMAccountName=" & sam & "))"

'List all attributes you will require
strAttributes = "sAMAccountName,distinguishedName,name"

'compose query
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
objCommand.CommandText = strQuery
objCommand.Properties("Page Size") = 99999
objCommand.Properties("Timeout") = 300
objCommand.Properties("Cache Results") = False

Set objRecordSet = objCommand.Execute

objRecordSet.MoveFirst
Do Until objRecordSet.EOF
    strSA = objRecordSet.Fields("sAMAccountName")
    strDN = objRecordSet.Fields("distinguishedName")
    strUserName = objRecordSet.Fields("name")
    strDomainUser = domain & "/" & strSA
    Set objUser = GetObject("WinNT://" & strDomainUser ) 
    Desc = objUser.Description
'        Wscript.Echo """" & strDN & """"
'        Wscript.Echo """" & strSA & """;""" & strUserName & """;""" & strDN  & """;""" & Desc  & """"
' Now write that string to a file which is created
' within the EDATEMP folder and is therefore temporary
    OutPutFile.WriteLine  """" & strSA & """;""" & strUserName & """;""" & strDN  & """;""" & Desc  & """"
'    OutPutFile.WriteLine strSA & "	;	" & strUserName
    objRecordSet.MoveNext
Loop

' Clean up.
objConnection.Close
Set objConnection = Nothing
Set objCommand = Nothing
Set objRootDSE = Nothing
Set objRecordSet = Nothing


Which I call with a DOS bat job -

getUserd.vbs smith*


Have a play with it

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
quote:
Originally posted by dhagen:
For the record, WF 7.1.1 and up has LDAP as a data adaptor. You can now query your LDAP environment with the TABLE command.


Could you please explain how this might be done? Do you have any examples? We are on 7.1.3 and would like to access a corporate LDAP. We currently are using CGI, HTML and Javascript in our application.
WebFOCUS LDAP Adapter, A fairly new adapter is the WebFOCUS LDAP Adapter which when configured can be used to Query LDAP or AD to reterive information. I have recently installed this at a customer site and with a few changes to the Master File Description that the Adapter creates I was able to access information from AD. In Querying AD a big benefit I saw was the ability to get a users mail address. Now with the LDAP Adapter and Report Casters ability to create dynamic distribution list WebFOCUS can create those list from extracts from LDAP/AD. Another Key advantged that a AD Administrator pointed out to me is being able to create reports that can be used to audit her AD Environment.

Hope this Helps




Scott

Sorry it took me so long to see this.
I don't have access to how they did the LDAP part. I wish I did.

quote:
Originally posted by db:
Joan,would you mind sharing the steps to configure or set that up. I need to pull some info from our corporate database to create variables.

Thanks

We run our WF Reporting Servers on Linux. Most native Unix and Linux operating systems come with the "ldapsearch" client. You can verify this by simply telneting into your host and type "ldapsearch" on the command line to see if it is available.

Once you have overcome the syntax of the "ldapsearch" command you should be able to query your ldap server from a line mode unix prompt. Once you have accomplished that, now it is simply a matter of issuing the command from a focexec by prefacing it with the word "unix". For example:

unix ldapsearch -b "o=mayo,c=us" -h ldap.mayo.edu -p 389 -x sn=smith
Now I wish we ran on Linux or Unix...

Thanks for the info!
Another option, that we use, is to call a small Java program that queries LDAP, and writes the output to a file. WebFOCUS then reads that file to get the results.


Diptesh
WF 7.1.7 - AIX, MVS
Joan,

What about the WebFOCUS LDAP Adapter. I think that might help.




Scott

To TexasStingray -- I'm thinking I would like to look into the LDAP adapter. I personally don't have access enough to load/configure it. And I'll have to see if we have installed the LDAP API.
Again to TexasStingray:
Does it sound right that our company has to purchase the LDAP Adapter?


quote:
Originally posted by TexasStingray:
Joan,

What about the WebFOCUS LDAP Adapter. I think that might help.

Hi Joan,

For more information on license for adapters, the best channel to contact for help should be our local branch office. If you need help on contact information of our local branch office, please let me know and I will be more than happy to find that out for you. Smiler

Many thanks for TexasStingray's input as well.

Cheers,

Kerry


Kerry Zhan
Focal Point Moderator
Information Builders, Inc.