github-ldap 1.1.3 → 1.1.4
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.
- checksums.yaml +4 -4
- data/github-ldap.gemspec +1 -1
- data/lib/github/ldap/domain.rb +4 -1
- data/lib/github/ldap/group.rb +26 -20
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2875d8763d34a8f62c3a4ae77dc9cc054b29fdc
|
4
|
+
data.tar.gz: fb968ff1b0ed9276f7a5586b38487387c8f079a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a679ac3db436a73260c120ff3504880ae948b3b6339aa20e72e90b7df51df3e983c9f39ca70dca1fc2ee6d9e8ee4b4f034c9c2f2140af94f67dc7e0dfbf582bd
|
7
|
+
data.tar.gz: 6bc82a3b3cc07c91c12438f8fe9ada80419a21aceeba5bb0c8034c5e3c3e4305c2067130969d41b6f5ecfe1bd5c22529a7b7880e165f6e9f6257fd0cd2f49a43
|
data/github-ldap.gemspec
CHANGED
data/lib/github/ldap/domain.rb
CHANGED
@@ -137,7 +137,10 @@ module GitHub
|
|
137
137
|
options[:ignore_server_caps] ||= true
|
138
138
|
options[:paged_searches_supported] ||= true
|
139
139
|
|
140
|
-
|
140
|
+
rs = @ldap.search(options)
|
141
|
+
return [] if rs == false
|
142
|
+
|
143
|
+
Array(rs)
|
141
144
|
end
|
142
145
|
|
143
146
|
# Provide a meaningful result after a protocol operation (for example,
|
data/lib/github/ldap/group.rb
CHANGED
@@ -21,32 +21,18 @@ module GitHub
|
|
21
21
|
#
|
22
22
|
# Returns an array with all the member entries.
|
23
23
|
def members
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
cache = load_cache(groups)
|
28
|
-
|
29
|
-
loop_cached_groups(groups, cache) do |_, users|
|
30
|
-
results.concat users
|
31
|
-
end
|
32
|
-
|
33
|
-
results.uniq {|m| m.dn }
|
24
|
+
return @all_members if @all_members
|
25
|
+
group_and_member_entries
|
26
|
+
@all_members
|
34
27
|
end
|
35
28
|
|
36
29
|
# Public - Get all the subgroups from a group recursively.
|
37
30
|
#
|
38
31
|
# Returns an array with all the subgroup entries.
|
39
32
|
def subgroups
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
cache = load_cache(groups)
|
44
|
-
|
45
|
-
loop_cached_groups(groups, cache) do |subgroups, _|
|
46
|
-
results.concat subgroups
|
47
|
-
end
|
48
|
-
|
49
|
-
results
|
33
|
+
return @all_groups if @all_groups
|
34
|
+
group_and_member_entries
|
35
|
+
@all_groups
|
50
36
|
end
|
51
37
|
|
52
38
|
# Public - Check if a user dn is included in the members of this group and its subgroups.
|
@@ -119,6 +105,26 @@ module GitHub
|
|
119
105
|
def groups_and_members
|
120
106
|
member_entries.partition {|e| group?(e[:objectclass])}
|
121
107
|
end
|
108
|
+
|
109
|
+
# Internal - Inspect the ldap server searching for group and member entries.
|
110
|
+
#
|
111
|
+
# Returns two arrays, the first one with subgroups and the second one with users.
|
112
|
+
def group_and_member_entries
|
113
|
+
groups, members = groups_and_members
|
114
|
+
@all_members = members
|
115
|
+
@all_groups = groups
|
116
|
+
|
117
|
+
cache = load_cache(groups)
|
118
|
+
|
119
|
+
loop_cached_groups(groups, cache) do |subgroups, users|
|
120
|
+
@all_groups.concat subgroups
|
121
|
+
@all_members.concat users
|
122
|
+
end
|
123
|
+
|
124
|
+
@all_members.uniq! {|m| m.dn }
|
125
|
+
|
126
|
+
[@all_groups, @all_members]
|
127
|
+
end
|
122
128
|
end
|
123
129
|
end
|
124
130
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: github-ldap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Calavera
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ldap
|