Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'net/ldap'
- class LdapService
- def con
- @ldap = Net::LDAP.new
- @ldap.host = '172.22.0.10'
- @ldap.port = 389
- @ldap.auth "CN=SSO,OU=SISTEMAS,OU=Users,OU=Desenvolvimento,OU=GEINF,OU=CRE,OU=SEFIN,DC=sefin,DC=ro,DC=gov,DC=br", "password"
- arr = []
- if @ldap.bind
- filter = "(&(objectClass=user)(sAMAccountName=))"
- treebase = "OU=distribution, OU=GEINF,OU=CRE,OU=SEFIN,DC=sefin,DC=ro,DC=gov,DC=br"
- @ldap.search(:base => treebase, :filter => filter) do |item|
- arr << item.cn
- end
- @ldap = {:usuarios => arr}
- else
- @ldap.get_operation_result
- end
- end
- end
Add Comment
Please, Sign In to add comment