diff --git a/active_directory.gemspec b/active_directory.gemspec index a3cf820..9faa78e 100644 --- a/active_directory.gemspec +++ b/active_directory.gemspec @@ -1,4 +1,5 @@ require File.expand_path("../lib/active_directory/version", __FILE__) +require 'date' Gem::Specification.new do |s| s.name = "active_directory" diff --git a/lib/active_directory/base.rb b/lib/active_directory/base.rb index 162b620..9c384ab 100644 --- a/lib/active_directory/base.rb +++ b/lib/active_directory/base.rb @@ -264,9 +264,11 @@ def self.find(*args) options = { :filter => (args[1].nil?) ? NIL_FILTER : args[1], - :in => (args[1].nil?) ? '' : ( args[1][:in] || '' ) + :in => (args[1].nil?) ? '' : ( args[1][:in] || '' ), + :attributes => (args[1].nil?) ? [] : (args[1][:attributes] || []) } options[:filter].delete(:in) + options[:filter].delete(:attributes) cached_results = find_cached_results(args[1]) return cached_results if cached_results or cached_results.nil? @@ -323,7 +325,7 @@ def self.find_cached_results(filters) def self.find_all(options) results = [] - ldap_objs = @@ldap.search(:filter => options[:filter], :base => options[:in]) || [] + ldap_objs = @@ldap.search(:filter => options[:filter], :base => options[:in], :attributes => options[:attributes]) || [] ldap_objs.each do |entry| ad_obj = new(entry) @@ -335,7 +337,7 @@ def self.find_all(options) end def self.find_first(options) - ldap_result = @@ldap.search(:filter => options[:filter], :base => options[:in]) + ldap_result = @@ldap.search(:filter => options[:filter], :base => options[:in], :attributes => options[:attributes]) return nil if ldap_result.empty? ad_obj = new(ldap_result[0])