From c2609c85a49aa2c702dbb47b1f66afd5f49316e2 Mon Sep 17 00:00:00 2001 From: jose Date: Tue, 28 Feb 2017 14:16:31 -0500 Subject: [PATCH 1/3] added :attributes => options[:attributes] to @@ldap.search in base find methods --- lib/active_directory/base.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/active_directory/base.rb b/lib/active_directory/base.rb index 162b620..2528024 100644 --- a/lib/active_directory/base.rb +++ b/lib/active_directory/base.rb @@ -323,7 +323,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 +335,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]) From 7184f4ed0a172192199b4ce6ec1a28f013125ecd Mon Sep 17 00:00:00 2001 From: jose Date: Tue, 28 Feb 2017 14:40:11 -0500 Subject: [PATCH 2/3] added require 'date' to gemspec due to error that Date was unknown when installing --- active_directory.gemspec | 1 + 1 file changed, 1 insertion(+) 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" From 65b4ba5ca093b7969118192b1d79242f3830f044 Mon Sep 17 00:00:00 2001 From: jose Date: Thu, 2 Mar 2017 14:16:37 -0500 Subject: [PATCH 3/3] Added attributes to base find method where you specify :all or :first --- lib/active_directory/base.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/active_directory/base.rb b/lib/active_directory/base.rb index 2528024..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?