ad-ldap 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ad-ldap.gemspec +2 -2
- data/lib/ad-ldap.rb +1 -1
- data/lib/ad-ldap/adapter.rb +2 -2
- data/lib/ad-ldap/exceptions.rb +5 -3
- data/lib/ad-ldap/logger.rb +1 -1
- data/lib/ad-ldap/search_args.rb +3 -0
- data/lib/ad-ldap/version.rb +1 -1
- data/test/unit/ad-ldap/search_args_test.rb +5 -1
- data/test/unit/ad-ldap_test.rb +1 -1
- metadata +9 -7
data/ad-ldap.gemspec
CHANGED
@@ -19,6 +19,6 @@ Gem::Specification.new do |s|
|
|
19
19
|
|
20
20
|
s.add_runtime_dependency "net-ldap", "~>0.2.2"
|
21
21
|
|
22
|
-
s.add_development_dependency "assert"
|
23
|
-
s.add_development_dependency "mocha",
|
22
|
+
s.add_development_dependency "assert", "=0.2.0"
|
23
|
+
s.add_development_dependency "mocha", "=0.9.12"
|
24
24
|
end
|
data/lib/ad-ldap.rb
CHANGED
@@ -80,7 +80,7 @@ module AD
|
|
80
80
|
# Inspired by https://github.com/tpett/perry logger
|
81
81
|
def run(method, *args)
|
82
82
|
result, time = [ nil, -1 ]
|
83
|
-
if self.config.run_commands
|
83
|
+
if self.config.run_commands || method == :search
|
84
84
|
time = (Benchmark.measure do
|
85
85
|
result = self.adapter.send(method, *args)
|
86
86
|
end).real
|
data/lib/ad-ldap/adapter.rb
CHANGED
@@ -13,11 +13,11 @@ module AD
|
|
13
13
|
super({
|
14
14
|
:host => self.config.host,
|
15
15
|
:port => self.config.port,
|
16
|
-
:base => self.config.
|
16
|
+
:base => self.config.treebase,
|
17
17
|
:encryption => self.config.encryption
|
18
18
|
})
|
19
19
|
if self.config.auth
|
20
|
-
self.auth(self.config.auth
|
20
|
+
self.auth(self.config.auth[:username], self.config.auth[:password])
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
data/lib/ad-ldap/exceptions.rb
CHANGED
data/lib/ad-ldap/logger.rb
CHANGED
@@ -14,7 +14,7 @@ module AD
|
|
14
14
|
color = "4;32;1"
|
15
15
|
name = "%s (%.1fms)" % [ "LDAP", time ]
|
16
16
|
message = self.generate_message(method, args)
|
17
|
-
output = " \e[#{color}
|
17
|
+
output = " \e[#{color}m#{name} #{message}\e[0m"
|
18
18
|
if self.logger
|
19
19
|
self.logger.debug(output)
|
20
20
|
elsif !self.silent
|
data/lib/ad-ldap/search_args.rb
CHANGED
data/lib/ad-ldap/version.rb
CHANGED
@@ -5,6 +5,7 @@ class AD::LDAP::SearchArgs
|
|
5
5
|
class BaseTest < Assert::Context
|
6
6
|
desc "the AD::LDAP::SearchArgs class"
|
7
7
|
setup do
|
8
|
+
AD::LDAP.config.treebase = @treebase = "DC=example, DC=com"
|
8
9
|
@search_args = AD::LDAP::SearchArgs.new({})
|
9
10
|
end
|
10
11
|
subject{ @search_args }
|
@@ -12,6 +13,9 @@ class AD::LDAP::SearchArgs
|
|
12
13
|
should "be a kind of Hash" do
|
13
14
|
assert_kind_of Hash, subject
|
14
15
|
end
|
16
|
+
should "set the base to the configured value for AD::LDAP" do
|
17
|
+
assert_equal @treebase, subject[:base]
|
18
|
+
end
|
15
19
|
end
|
16
20
|
|
17
21
|
class WithOnlyLDAPKeysTest < Assert::Context
|
@@ -75,7 +79,7 @@ class AD::LDAP::SearchArgs
|
|
75
79
|
@original = { :dn => "something", :objectclass => "top" }
|
76
80
|
first_filter = Net::LDAP::Filter.eq(:dn, @original[:dn])
|
77
81
|
second_filter = Net::LDAP::Filter.eq(:objectclass, @original[:objectclass])
|
78
|
-
@expected_filter = Net::LDAP::Filter.join(
|
82
|
+
@expected_filter = Net::LDAP::Filter.join(first_filter, second_filter)
|
79
83
|
@search_args = AD::LDAP::SearchArgs.new(@original)
|
80
84
|
end
|
81
85
|
subject{ @search_args }
|
data/test/unit/ad-ldap_test.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ad-ldap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
- 0
|
9
8
|
- 1
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Collin Redding
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-08-
|
18
|
+
date: 2011-08-19 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -40,12 +40,14 @@ dependencies:
|
|
40
40
|
version_requirements: &id002 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
|
-
- - "
|
43
|
+
- - "="
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
hash:
|
45
|
+
hash: 23
|
46
46
|
segments:
|
47
47
|
- 0
|
48
|
-
|
48
|
+
- 2
|
49
|
+
- 0
|
50
|
+
version: 0.2.0
|
49
51
|
type: :development
|
50
52
|
requirement: *id002
|
51
53
|
- !ruby/object:Gem::Dependency
|