ruby-net-ldap paged search control

M

Maxxis MP

Hi,

Could anyone help me on how to use the ruby-net-ldap paged search
control?
I have read in forums that Net::LDAP library supports paged results
transparently.
My problem is I don't know how to embed it in my code.

I need to search users from ldap and paginate the results return by the
server.

Here is the sample code.

ldap = Net::LDAP.new( {:host => LDAP_SERVER_IP_ADDRESS,
:port => LDAP_SERVER_PORT } )
#call LDAP authentication
ldap.auth( "#{LDAP_USERNAME}","#{LDAP_PWD}" )

user_array = []
user_hash = {}
treebase = "sample treebase"
filter = "myfilter"
attrs = ["sample attributes"]

#bind LDAP authentication
if ldap.bind

ldap.search:)base=>treebase, :filter=>filter,:attributes=>attrs) do
|entry|
#I process the entry here to store in hash
user_hash = {
:name => entry[:cn],
:lastname=>entry[:sn]
}
end
user_array << user_hash
end

return user_array

Please help me on where should do it. Can you please give me code
snippet so that I can embed it in my code.

Many Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,188
Latest member
Crypto TaxSoftware

Latest Threads

Top