So I am having difficulty getting the attributes for an LDAP entry. If
I
check for specific attributes by name that works fine. However when I
try
the following:
ldap.search(:base => base, :filter => address_only_filter,
:return_result =>
false) do |entry|
p entry.dn
p entry.attrs
puts “\n\n”
end
The docs say string or array of strings. Tried it with :attributes =>
[]
and I get the same error. I also tried reinstalling the gem but that
didn’t
help.
–
“Hey brother Christian with your high and mighty errand, Your actions
speak
so loud, I can’t hear a word you’re saying.”
The docs say string or array of strings. Tried it with :attributes =>
[]
and I get the same error. I also tried reinstalling the gem but that
didn’t
help.
What gem are you using? ruby-net-ldap? via require ‘net/ldap’?
Might help to post more of your code so I can understand the whole
picture of things…
p entry.attrs is invalid as it isn’t a method per’se… hence the
NoMethodError.
attrs is like you said a string or array of strings.
It should be used via connection.add(“dc=localhost, dc=localdomain”,
entry)
ldap.search(:base => base, :scope =>
Net::LDAP::SearchScope_WholeSubtree,
:filter => address_only_filter, :attributes => “*”) do |entry|
p entry.dn
p entry.attrs
end
I’ve removed the credentials and the host IP intentionally. Calling a
specific attribute on the object works just fine. It just breaks when I
try
to request all of them. I figured it would be the easiest way to ensure
I
only remove the attribute I’m interested in since not all records are
sure
to have the same attributes.
–
“Hey brother Christian with your high and mighty errand, Your actions
speak
so loud, I can’t hear a word you’re saying.”
-Greg Graffin (Bad Religion)
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.