Took a suggestion from Andre Nathan (andre@digirati.com.br)
to change the behavior of Net::LDAP::Filter#method_missing to allow case-insensitive attribute names.
This commit is contained in:
parent
7de0147b21
commit
241d9b8fb3
2 changed files with 10 additions and 4 deletions
|
@ -50,7 +50,7 @@ class LDAP
|
|||
# restrict the range of characters allowed in attribute names.
|
||||
# To simplify handling attribute names, Net::LDAP::Entry
|
||||
# internally converts them to a standard format. Therefore, the
|
||||
# methods which take attribute names can take Strings or Synmbols,
|
||||
# methods which take attribute names can take Strings or Symbols,
|
||||
# and work correctly regardless of case or capitalization.
|
||||
#
|
||||
# An attribute consists of zero or more data items called
|
||||
|
@ -140,7 +140,7 @@ class LDAP
|
|||
# arguments or a block...
|
||||
#
|
||||
def method_missing *args, &block # :nodoc:
|
||||
s = args[0]
|
||||
s = args[0].to_s.downcase.intern
|
||||
if attribute_names.include?(s)
|
||||
self[s]
|
||||
elsif s.to_s[-1] == 61 and s.to_s.length > 1
|
||||
|
|
|
@ -272,8 +272,14 @@ class Filter
|
|||
|
||||
# Converts an LDAP filter-string (in the prefix syntax specified in RFC-2254)
|
||||
# to a Net::LDAP::Filter.
|
||||
def self.from_rfc2254 str
|
||||
FilterParser.new(str).filter
|
||||
def self.construct ldap_filter_string
|
||||
FilterParser.new(ldap_filter_string).filter
|
||||
end
|
||||
|
||||
# Synonym for #construct.
|
||||
# to a Net::LDAP::Filter.
|
||||
def self.from_rfc2254 ldap_filter_string
|
||||
construct ldap_filter_string
|
||||
end
|
||||
|
||||
end # class Net::LDAP::Filter
|
||||
|
|
Loading…
Reference in a new issue