ad-ldap 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +0 -1
- data/Gemfile.lock +24 -0
- data/ad-ldap.gemspec +2 -2
- data/lib/ad-ldap.rb +1 -1
- data/lib/ad-ldap/search_args.rb +1 -1
- data/lib/ad-ldap/version.rb +1 -1
- data/test/unit/ad-ldap/search_args_test.rb +20 -20
- metadata +23 -24
data/.gitignore
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
ad-ldap (0.1.1)
|
5
|
+
net-ldap (~> 0.2.2)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
ansi (1.3.0)
|
11
|
+
assert (0.3.0)
|
12
|
+
ansi (~> 1.3)
|
13
|
+
mocha (0.9.12)
|
14
|
+
net-ldap (0.2.2)
|
15
|
+
rake (0.9.2)
|
16
|
+
|
17
|
+
PLATFORMS
|
18
|
+
ruby
|
19
|
+
|
20
|
+
DEPENDENCIES
|
21
|
+
ad-ldap!
|
22
|
+
assert (~> 0.3.0)
|
23
|
+
mocha (~> 0.9.12)
|
24
|
+
rake (~> 0.9.2)
|
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.3.0"
|
23
|
+
s.add_development_dependency "mocha", "~>0.9.12"
|
24
24
|
end
|
data/lib/ad-ldap.rb
CHANGED
@@ -70,7 +70,7 @@ module AD
|
|
70
70
|
size = search_args.delete(:size)
|
71
71
|
end
|
72
72
|
results = (self.run(:search, search_args) || [])
|
73
|
-
if !self.config.search_size_supported && size
|
73
|
+
if !self.config.search_size_supported && size
|
74
74
|
results[0..(size.to_i - 1)]
|
75
75
|
else
|
76
76
|
results
|
data/lib/ad-ldap/search_args.rb
CHANGED
@@ -31,7 +31,7 @@ module AD
|
|
31
31
|
protected
|
32
32
|
|
33
33
|
def build_filters(conditions = {})
|
34
|
-
conditions.inject(nil) do |filters, (key, value)|
|
34
|
+
conditions.sort_by{|(key, value)| key.to_s }.inject(nil) do |filters, (key, value)|
|
35
35
|
field, operator = key.to_s.split("__")
|
36
36
|
operator ||= "eq"
|
37
37
|
if mapping = AD::LDAP.config.mappings[field.to_sym]
|
data/lib/ad-ldap/version.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'assert'
|
2
2
|
|
3
3
|
class AD::LDAP::SearchArgs
|
4
|
-
|
4
|
+
|
5
5
|
class BaseTest < Assert::Context
|
6
6
|
desc "the AD::LDAP::SearchArgs class"
|
7
7
|
setup do
|
@@ -9,7 +9,7 @@ class AD::LDAP::SearchArgs
|
|
9
9
|
@search_args = AD::LDAP::SearchArgs.new({})
|
10
10
|
end
|
11
11
|
subject{ @search_args }
|
12
|
-
|
12
|
+
|
13
13
|
should "be a kind of Hash" do
|
14
14
|
assert_kind_of Hash, subject
|
15
15
|
end
|
@@ -17,7 +17,7 @@ class AD::LDAP::SearchArgs
|
|
17
17
|
assert_equal @treebase, subject[:base]
|
18
18
|
end
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
class WithOnlyLDAPKeysTest < Assert::Context
|
22
22
|
desc "the AD::LDAP::SearchArgs initialized with only net-ldap keys"
|
23
23
|
setup do
|
@@ -28,14 +28,14 @@ class AD::LDAP::SearchArgs
|
|
28
28
|
@search_args = AD::LDAP::SearchArgs.new(@original)
|
29
29
|
end
|
30
30
|
subject{ @search_args }
|
31
|
-
|
31
|
+
|
32
32
|
should "not alter the hash passed to it" do
|
33
33
|
@original.each do |key, value|
|
34
34
|
assert_equal value, @search_args[key]
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
class WithNonLDAPKeysTest < Assert::Context
|
40
40
|
desc "the AD::LDAP::SearchArgs initialized with non net-ldap keys"
|
41
41
|
setup do
|
@@ -47,13 +47,13 @@ class AD::LDAP::SearchArgs
|
|
47
47
|
@search_args = AD::LDAP::SearchArgs.new(@original)
|
48
48
|
end
|
49
49
|
subject{ @search_args }
|
50
|
-
|
50
|
+
|
51
51
|
should "set the filter based off the non net-ldap keys" do
|
52
52
|
assert_equal @original[:base], subject[:base]
|
53
53
|
assert_equal @expected_filter.to_s, subject[:filter].to_s
|
54
54
|
end
|
55
55
|
end
|
56
|
-
|
56
|
+
|
57
57
|
class WithMappingsTest < Assert::Context
|
58
58
|
desc "search args with a mapping filter"
|
59
59
|
setup do
|
@@ -63,16 +63,16 @@ class AD::LDAP::SearchArgs
|
|
63
63
|
@search_args = AD::LDAP::SearchArgs.new(@original)
|
64
64
|
end
|
65
65
|
subject{ @search_args }
|
66
|
-
|
66
|
+
|
67
67
|
should "use the mapping for the field" do
|
68
68
|
assert_equal @expected_filter.to_s, subject[:filter].to_s
|
69
69
|
end
|
70
|
-
|
70
|
+
|
71
71
|
teardown do
|
72
72
|
AD::LDAP.config.mappings = {}
|
73
73
|
end
|
74
74
|
end
|
75
|
-
|
75
|
+
|
76
76
|
class WithMultipleFiltersTest < Assert::Context
|
77
77
|
desc "search args with a multiple filters"
|
78
78
|
setup do
|
@@ -83,12 +83,12 @@ class AD::LDAP::SearchArgs
|
|
83
83
|
@search_args = AD::LDAP::SearchArgs.new(@original)
|
84
84
|
end
|
85
85
|
subject{ @search_args }
|
86
|
-
|
86
|
+
|
87
87
|
should "join the filters together" do
|
88
88
|
assert_equal @expected_filter.to_s, subject[:filter].to_s
|
89
89
|
end
|
90
90
|
end
|
91
|
-
|
91
|
+
|
92
92
|
class WithEqualFilterTest < Assert::Context
|
93
93
|
desc "search args with a equal filter"
|
94
94
|
setup do
|
@@ -97,12 +97,12 @@ class AD::LDAP::SearchArgs
|
|
97
97
|
@search_args = AD::LDAP::SearchArgs.new(@original)
|
98
98
|
end
|
99
99
|
subject{ @search_args }
|
100
|
-
|
100
|
+
|
101
101
|
should "create an equal filter for the field" do
|
102
102
|
assert_equal @expected_filter.to_s, subject[:filter].to_s
|
103
103
|
end
|
104
104
|
end
|
105
|
-
|
105
|
+
|
106
106
|
class WithNotEqualFilterTest < Assert::Context
|
107
107
|
desc "search args with a not equal filter"
|
108
108
|
setup do
|
@@ -111,12 +111,12 @@ class AD::LDAP::SearchArgs
|
|
111
111
|
@search_args = AD::LDAP::SearchArgs.new(@original)
|
112
112
|
end
|
113
113
|
subject{ @search_args }
|
114
|
-
|
114
|
+
|
115
115
|
should "create a not equal filter for the field" do
|
116
116
|
assert_equal @expected_filter.to_s, subject[:filter].to_s
|
117
117
|
end
|
118
118
|
end
|
119
|
-
|
119
|
+
|
120
120
|
class WithGreaterThanOrEqualFilterTest < Assert::Context
|
121
121
|
desc "search args with a greater than or equal filter"
|
122
122
|
setup do
|
@@ -125,12 +125,12 @@ class AD::LDAP::SearchArgs
|
|
125
125
|
@search_args = AD::LDAP::SearchArgs.new(@original)
|
126
126
|
end
|
127
127
|
subject{ @search_args }
|
128
|
-
|
128
|
+
|
129
129
|
should "create a greater than or equal filter for the field" do
|
130
130
|
assert_equal @expected_filter.to_s, subject[:filter].to_s
|
131
131
|
end
|
132
132
|
end
|
133
|
-
|
133
|
+
|
134
134
|
class WithLessThanOrEqualFilterTest < Assert::Context
|
135
135
|
desc "search args with a less than or equal filter"
|
136
136
|
setup do
|
@@ -139,10 +139,10 @@ class AD::LDAP::SearchArgs
|
|
139
139
|
@search_args = AD::LDAP::SearchArgs.new(@original)
|
140
140
|
end
|
141
141
|
subject{ @search_args }
|
142
|
-
|
142
|
+
|
143
143
|
should "create a less than or equal filter for the field" do
|
144
144
|
assert_equal @expected_filter.to_s, subject[:filter].to_s
|
145
145
|
end
|
146
146
|
end
|
147
|
-
|
147
|
+
|
148
148
|
end
|
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: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Collin Redding
|
@@ -15,13 +15,12 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-08-
|
19
|
-
default_executable:
|
18
|
+
date: 2011-08-29 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
|
-
|
21
|
+
type: :runtime
|
23
22
|
prerelease: false
|
24
|
-
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
24
|
none: false
|
26
25
|
requirements:
|
27
26
|
- - ~>
|
@@ -32,31 +31,31 @@ dependencies:
|
|
32
31
|
- 2
|
33
32
|
- 2
|
34
33
|
version: 0.2.2
|
35
|
-
|
36
|
-
|
34
|
+
version_requirements: *id001
|
35
|
+
name: net-ldap
|
37
36
|
- !ruby/object:Gem::Dependency
|
38
|
-
|
37
|
+
type: :development
|
39
38
|
prerelease: false
|
40
|
-
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
40
|
none: false
|
42
41
|
requirements:
|
43
|
-
- -
|
42
|
+
- - ~>
|
44
43
|
- !ruby/object:Gem::Version
|
45
|
-
hash:
|
44
|
+
hash: 19
|
46
45
|
segments:
|
47
46
|
- 0
|
48
|
-
-
|
47
|
+
- 3
|
49
48
|
- 0
|
50
|
-
version: 0.
|
51
|
-
|
52
|
-
|
49
|
+
version: 0.3.0
|
50
|
+
version_requirements: *id002
|
51
|
+
name: assert
|
53
52
|
- !ruby/object:Gem::Dependency
|
54
|
-
|
53
|
+
type: :development
|
55
54
|
prerelease: false
|
56
|
-
|
55
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
57
56
|
none: false
|
58
57
|
requirements:
|
59
|
-
- -
|
58
|
+
- - ~>
|
60
59
|
- !ruby/object:Gem::Version
|
61
60
|
hash: 35
|
62
61
|
segments:
|
@@ -64,8 +63,8 @@ dependencies:
|
|
64
63
|
- 9
|
65
64
|
- 12
|
66
65
|
version: 0.9.12
|
67
|
-
|
68
|
-
|
66
|
+
version_requirements: *id003
|
67
|
+
name: mocha
|
69
68
|
description: A small wrapper to Net::LDAP to provide some extended functionality and utility.
|
70
69
|
email:
|
71
70
|
executables: []
|
@@ -77,6 +76,7 @@ extra_rdoc_files: []
|
|
77
76
|
files:
|
78
77
|
- .gitignore
|
79
78
|
- Gemfile
|
79
|
+
- Gemfile.lock
|
80
80
|
- README.markdown
|
81
81
|
- Rakefile
|
82
82
|
- ad-ldap.gemspec
|
@@ -93,7 +93,6 @@ files:
|
|
93
93
|
- test/unit/ad-ldap/response_test.rb
|
94
94
|
- test/unit/ad-ldap/search_args_test.rb
|
95
95
|
- test/unit/ad-ldap_test.rb
|
96
|
-
has_rdoc: true
|
97
96
|
homepage: http://github.com/teaminsight/ad-ldap
|
98
97
|
licenses: []
|
99
98
|
|
@@ -123,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
122
|
requirements: []
|
124
123
|
|
125
124
|
rubyforge_project: ad-ldap
|
126
|
-
rubygems_version: 1.
|
125
|
+
rubygems_version: 1.8.8
|
127
126
|
signing_key:
|
128
127
|
specification_version: 3
|
129
128
|
summary: A small wrapper to Net::LDAP to provide some extended functionality and utility.
|