ldap_lookup 0.1.1 → 0.1.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b5b583715ad3b95d22f008c3daab7402cc11a348559c0447c7aec8d5bd4010bc
4
- data.tar.gz: 595f735c9a167784f00c4d5b4d92dd097a51b0dbc9b7ae94399960b7d8979220
3
+ metadata.gz: c758df2ba4bd275893bab9423486dbf4c8befb3002a9bc480f4f2e4b5d465885
4
+ data.tar.gz: e6c69664b9b03a99725467988028c003e7610bcaaac0f5f0195fae4c19ca4ee5
5
5
  SHA512:
6
- metadata.gz: 843e17377dd313b7c0eda8c030030bc65953cb3998d80a1a1ea8a75920f9967c119859f6b62793649d198c276aaf6d253e8c5c08f166ec8c17b8507552a1f59f
7
- data.tar.gz: abff197d0a1631afbe7f03bf94b0c90b3cf5a8bff6f669a325f85a68aa57f422ca27249861610fc775a0c80b96bbb34cee23bf29aa748682b16ac2d1fcaa7895
6
+ metadata.gz: 358f2ba236db3721236483e2017286d07ffad110f9a60946589d0ca20626d9829a970a9e9dabcd2a9243c3c8cd56a19ca0e8be5949983d1479fea77494e5adc0
7
+ data.tar.gz: 3bc39049501bbab4f7751269c7a5ef12262bd5752c27f38b349ec1171393fe5397d5511ef3ef77e12dc870af6aa12e178b082b433a0abe6545360330aa26a181
data/Gemfile.lock ADDED
@@ -0,0 +1,37 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ldap_lookup (0.1.1)
5
+ net-ldap (~> 0.16.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ diff-lcs (1.3)
11
+ net-ldap (0.16.1)
12
+ rake (13.0.1)
13
+ rspec (3.7.0)
14
+ rspec-core (~> 3.7.0)
15
+ rspec-expectations (~> 3.7.0)
16
+ rspec-mocks (~> 3.7.0)
17
+ rspec-core (3.7.1)
18
+ rspec-support (~> 3.7.0)
19
+ rspec-expectations (3.7.0)
20
+ diff-lcs (>= 1.2.0, < 2.0)
21
+ rspec-support (~> 3.7.0)
22
+ rspec-mocks (3.7.0)
23
+ diff-lcs (>= 1.2.0, < 2.0)
24
+ rspec-support (~> 3.7.0)
25
+ rspec-support (3.7.1)
26
+
27
+ PLATFORMS
28
+ ruby
29
+
30
+ DEPENDENCIES
31
+ bundler (~> 1.16)
32
+ ldap_lookup!
33
+ rake (~> 13.0)
34
+ rspec (~> 3.7.0)
35
+
36
+ BUNDLED WITH
37
+ 1.16.1
data/README.md CHANGED
@@ -1,6 +1,4 @@
1
- # LdapLookup for Ruby
2
-
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/ldap_lookup`. To experiment with that code, run `bin/console` for an interactive prompt.
1
+ # LdapLookup for Ruby [![Gem Version](https://badge.fury.io/rb/ldap_lookup.svg)](https://badge.fury.io/rb/ldap_lookup)
4
2
 
5
3
  ### Description
6
4
  This module is to be used for anonymous lookup of user attributes in the MCommunity service provide at the University of Michigan. It can be easily modifed to use other LDAP server configurations.
@@ -12,23 +10,20 @@ This module is to be used for anonymous lookup of user attributes in the MCommun
12
10
  Requirements:
13
11
  * Ruby at least 2.0.0
14
12
  * Gem 'net-ldap' ~> '0.16.1'
15
- > Install by running the following command at your command prompt_for_action
16
13
  > *The Net::LDAP (aka net-ldap) gem before 0.16.0 for Ruby has a Missing SSL Certificate Validation.*
17
- ```bash
18
- gem install net-ldap
19
- ```
20
14
 
21
15
  To try the module out:
22
16
  1. Clone the repo
23
17
  2. Edit the configurations by opening ldaptest.rb and set the *CONFIGURATION BLOCK* to your environment.
24
- ```ruby
18
+ <pre>
25
19
  LdapLookup.configuration do |config|
26
- config.host = < your host > # "ldap.umich.edu"
27
- config.base = < your LDAP base > # "dc=umich,dc=edu"
28
- config.dept_attribute = < your dept attribute > # "umichPostalAddressData"
29
- config.group_attribute = < your group email attribute > # "umichGroupEmail"
20
+ config.host = <em>< your host ></em> # "ldap.umich.edu"
21
+ config.port = <em>< your port ></em> # "986" the default is set to "389" so this optional
22
+ config.base = <em>< your LDAP base ></em> # "dc=umich,dc=edu"
23
+ config.dept_attribute = <em>< your dept attribute ></em> # "umichPostalAddressData"
24
+ config.group_attribute = <em>< your group email attribute ></em> # "umichGroupEmail"
30
25
  end
31
- ```
26
+ </pre>
32
27
 
33
28
  3. run the ldaptest.rb script
34
29
  ```ruby
@@ -54,40 +49,44 @@ Or install it yourself as:
54
49
  $ gem install ldap_lookup
55
50
 
56
51
  In your application create a file config/initializers/ldap_lookup.rb
57
- ```ruby
52
+ <pre>
58
53
  LdapLookup.configuration do |config|
59
- config.host = < your host > # "ldap.umich.edu"
60
- config.port = < your port > # "954" port 389 is set by default
61
- config.base = < your LDAP base > # "dc=umich,dc=edu"
62
- config.dept_attribute = < your dept attribute > # "umichPostalAddressData"
63
- config.group_attribute = < your group email attribute > # "umichGroupEmail"
54
+ config.host = <em>< your host ></em> # "ldap.umich.edu"
55
+ config.port = <em>< your port ></em> # "954" port 389 is set by default
56
+ config.base = <em>< your LDAP base ></em> # "dc=umich,dc=edu"
57
+ config.dept_attribute = <em>< your dept attribute ></em> # "umichPostalAddressData"
58
+ config.group_attribute = <em>< your group email attribute ></em> # "umichGroupEmail"
64
59
  end
65
- ```
60
+ </pre>
66
61
 
67
62
  ---
68
63
 
69
64
  ### Methods available
70
65
 
71
- get_simple_name: returns the Display Name
66
+ __get_simple_name:__ returns the Display Name
72
67
  ```
73
68
  LdapLookup.get_simple_name(uniqname = nil)
74
69
  ```
75
- get_dept: returns the users Department_name
70
+ __get_dept:__ returns the users Department_name
76
71
  ```
77
72
  LdapLookup.get_dept(uniqname = nil)
78
73
  ```
79
- get_email: returns the users email address
74
+ __get_email:__ returns the users email address
80
75
  ```
81
76
  LdapLookup.get_email(uniqname = nil)
82
77
  ```
83
- is_member_of_group?: returns true/false if uniqname is a member of the specified group
78
+ __is_member_of_group?:__ returns true/false if uniqname is a member of the specified group
84
79
  ```
85
80
  LdapLookup.is_member_of_group?(uid = nil, group_name = nil)
86
81
  ```
87
- get_email_distribution_list: Returns the list of emails that are associated to a group.
82
+ __get_email_distribution_list:__ Returns the list of emails that are associated to a group.
88
83
  ```
89
84
  LdapLookup.get_email_distribution_list(group_name = nil)
90
85
  ```
86
+ __all_groups_for_user:__ Returns the list of groups that a user is a member of.
87
+ ```
88
+ LdapLookup.all_groups_for_user(uniqname = nil)
89
+ ```
91
90
 
92
91
  ### Contributing
93
92
 
data/ldap_lookup.gemspec CHANGED
@@ -21,7 +21,8 @@ Gem::Specification.new do |spec|
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ["lib"]
23
23
 
24
- spec.add_development_dependency "bundler", "~> 1.16"
25
- spec.add_development_dependency "rake", "~> 10.0"
26
- spec.add_dependency 'net-ldap', '~> 0.16.1'
24
+ spec.add_development_dependency "bundler", "~> 2.2.26"
25
+ spec.add_development_dependency "rake", "~> 13.0"
26
+ spec.add_development_dependency "rspec", "~> 3.7.0"
27
+ spec.add_dependency 'net-ldap', '~> 0.17.0'
27
28
  end
data/ldaptest.rb CHANGED
@@ -1,21 +1,20 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require_relative 'lib/ldap_lookup'
3
+ require_relative "lib/ldap_lookup"
4
4
 
5
5
  class Ldaptest
6
-
7
6
  include LdapLookup
8
7
 
9
- ############## CONFIGURATION BLOCK ###################
8
+ ############## CONFIGURATION BLOCK ###################
10
9
  LdapLookup.configuration do |config|
11
10
  config.host = "ldap.umich.edu"
12
11
  config.base = "dc=umich,dc=edu"
13
12
  config.dept_attribute = "umichPostalAddressData"
14
13
  config.group_attribute = "umichGroupEmail"
15
14
  end
16
- #######################################################
15
+ #######################################################
17
16
 
18
- def initialize(name=nil)
17
+ def initialize(name = nil)
19
18
  @uid = name
20
19
  @group_uid = nil
21
20
  end
@@ -59,6 +58,7 @@ class Ldaptest
59
58
  puts "3: get users full name"
60
59
  puts "4: get users department"
61
60
  puts "5: get users email"
61
+ puts "55: get all groups a user is a member of"
62
62
  puts "+++++++++++++++++++++++++"
63
63
  puts "6: get ldap group-name member listing"
64
64
  puts "7: check if uid is member of a group"
@@ -72,14 +72,15 @@ class Ldaptest
72
72
  when 3 then result_box(LdapLookup.get_simple_name(@uid))
73
73
  when 4 then result_box(LdapLookup.get_dept(@uid))
74
74
  when 5 then result_box(LdapLookup.get_email(@uid))
75
+ when 55 then result_box(LdapLookup.all_groups_for_user(@uid))
75
76
  when 6 then result_box(LdapLookup.get_email_distribution_list(@group_uid))
76
- when 7 then result_box(LdapLookup.is_member_of_group?(@uid,@group_uid))
77
+ when 7 then result_box(LdapLookup.is_member_of_group?(@uid, @group_uid))
77
78
  when 8 then result_box(timestamp)
78
79
  when 0 then puts "you chose exit!"
79
- throw(:done)
80
+ throw(:done)
80
81
  else
81
82
  print "\e[2J\e[f"
82
- puts "====> Please type 1,2,3,4,5,6,7,8 or 0 only"
83
+ puts "====> Please type 1,2,3,4,5,55,6,7,8 or 0 only"
83
84
  2.times { puts " " }
84
85
  end
85
86
  end
@@ -92,6 +93,7 @@ class Ldaptest
92
93
  end
93
94
  end
94
95
  end
96
+
95
97
  print "\e[2J\e[f"
96
98
  print "Enter a valid UID=> "
97
99
  name = gets.chomp.to_s
data/lib/ldap_lookup.rb CHANGED
@@ -1,7 +1,7 @@
1
- require_relative 'helpers/configuration'
1
+ require_relative "helpers/configuration"
2
2
 
3
3
  module LdapLookup
4
- require 'net/ldap'
4
+ require "net/ldap"
5
5
 
6
6
  extend Configuration
7
7
 
@@ -11,126 +11,147 @@ module LdapLookup
11
11
  define_setting :dept_attribute
12
12
  define_setting :group_attribute
13
13
 
14
- # this was developed using guidence from this gist:
15
- # https://gist.githubusercontent.com/jeffjohnson9046/7012167/raw/86587b9637ddc2ece7a42df774980fa9c0aac9b3/ruby-ldap-sample.rb
14
+ # this was developed using guidence from this gist:
15
+ # https://gist.githubusercontent.com/jeffjohnson9046/7012167/raw/86587b9637ddc2ece7a42df774980fa9c0aac9b3/ruby-ldap-sample.rb
16
16
 
17
- #######################################################################################################################
18
- ## HELPER/UTILITY METHOD
19
- ## This method interprets the response/return code from an LDAP bind operation (bind, search, add, modify, rename,
20
- ## delete). This method isn't necessarily complete, but it's a good starting point for handling the response codes
21
- ## from an LDAP bind operation.
22
- ##
23
- ## Additional details for the get_operation_result method can be found here:
24
- ## http://net-ldap.rubyforge.org/Net/LDAP.html#method-i-get_operation_result
25
- ########################################################################################################################
26
- def self.get_ldap_response(ldap)
27
- msg = "Response Code: #{ ldap.get_operation_result.code }, Message: #{ ldap.get_operation_result.message }"
28
- raise msg unless ldap.get_operation_result.code == 0
29
- end
17
+ #######################################################################################################################
18
+ ## HELPER/UTILITY METHOD
19
+ ## This method interprets the response/return code from an LDAP bind operation (bind, search, add, modify, rename,
20
+ ## delete). This method isn't necessarily complete, but it's a good starting point for handling the response codes
21
+ ## from an LDAP bind operation.
22
+ ##
23
+ ## Additional details for the get_operation_result method can be found here:
24
+ ## http://net-ldap.rubyforge.org/Net/LDAP.html#method-i-get_operation_result
25
+ ########################################################################################################################
26
+ def self.get_ldap_response(ldap)
27
+ msg = "Response Code: #{ldap.get_operation_result.code}, Message: #{ldap.get_operation_result.message}"
28
+ raise msg unless ldap.get_operation_result.code == 0
29
+ end
30
30
 
31
- #######################################################################################################################
32
- # SET UP LDAP CONNECTION
33
- # Setting up a connection to the LDAP server using .new() does not actually send any network traffic to the LDAP
34
- # server. When you call an operation on ldap (e.g. add or search), .bind is called implicitly. *That's* when the
35
- # connection is made to the LDAP server. This means that each operation called on the ldap object will create its own
36
- # network connection to the LDAP server.
37
- #######################################################################################################################
38
- def self.ldap_connection
39
- ldap = Net::LDAP.new host: LdapLookup.host, # your LDAP host name or IP goes here,
40
- port: LdapLookup.port, # your LDAP host port goes here,
41
- base: LdapLookup.base, # the base of your AD tree goes here,
42
- auth: {
43
- :method => :anonymous
44
- }
45
- end
31
+ #######################################################################################################################
32
+ # SET UP LDAP CONNECTION
33
+ # Setting up a connection to the LDAP server using .new() does not actually send any network traffic to the LDAP
34
+ # server. When you call an operation on ldap (e.g. add or search), .bind is called implicitly. *That's* when the
35
+ # connection is made to the LDAP server. This means that each operation called on the ldap object will create its own
36
+ # network connection to the LDAP server.
37
+ #######################################################################################################################
38
+ def self.ldap_connection
39
+ ldap = Net::LDAP.new host: host, # your LDAP host name or IP goes here,
40
+ port: port, # your LDAP host port goes here,
41
+ base: base, # the base of your AD tree goes here,
42
+ auth: {
43
+ :method => :anonymous,
44
+ }
45
+ end
46
46
 
47
- # GET THE DISPLAY NAME FOR A SINGLE USER
48
- def LdapLookup.get_simple_name(uniqname = nil)
49
- ldap = ldap_connection
50
- search_param = uniqname # the AD account goes here
51
- result_attrs = ["displayName"] # Whatever you want to bring back in your result set goes here
52
- # Build filter
53
- search_filter = Net::LDAP::Filter.eq("uid", search_param)
54
- # Execute search
55
- ldap.search(filter: search_filter, attributes: result_attrs) { |item|
47
+ # GET THE DISPLAY NAME FOR A SINGLE USER
48
+ def self.get_simple_name(uniqname = nil)
49
+ ldap = ldap_connection
50
+ search_param = uniqname # the AD account goes here
51
+ result_attrs = ["displayName"] # Whatever you want to bring back in your result set goes here
52
+ # Build filter
53
+ search_filter = Net::LDAP::Filter.eq("uid", search_param)
54
+ # Execute search
55
+ ldap.search(filter: search_filter, attributes: result_attrs) { |item|
56
+ begin
56
57
  return item.displayName.first
57
- }
58
- get_ldap_response(ldap)
59
- end
58
+ rescue
59
+ return "not available"
60
+ end
61
+ }
62
+ get_ldap_response(ldap)
63
+ end
60
64
 
61
- # GET THE PRIMARY DEPARTMENT FOR A SINGLE USER
62
- def LdapLookup.get_dept(uniqname = nil)
63
- ldap = ldap_connection
64
- search_param = uniqname # the AD account goes here
65
- result_attrs = [LdapLookup.dept_attribute] # Whatever you want to bring back in your result set goes here
66
- # Build filter
67
- search_filter = Net::LDAP::Filter.eq("uid", search_param)
68
- # Execute search
69
- ldap.search(filter: search_filter, attributes: result_attrs) { |item|
70
- return dept_name = item.umichpostaladdressdata.first.split("}:{").first.split("=")[1] unless item.umichpostaladdressdata.first.nil?
71
- }
72
- get_ldap_response(ldap)
73
- end
65
+ # GET THE PRIMARY DEPARTMENT FOR A SINGLE USER
66
+ def self.get_dept(uniqname = nil)
67
+ ldap = ldap_connection
68
+ search_param = uniqname # the AD account goes here
69
+ result_attrs = [dept_attribute] # Whatever you want to bring back in your result set goes here
70
+ # Build filter
71
+ search_filter = Net::LDAP::Filter.eq("uid", search_param)
72
+ # Execute search
73
+ ldap.search(filter: search_filter, attributes: result_attrs) { |item|
74
+ return dept_name = item.umichpostaladdressdata.first.split("}:{").first.split("=")[1] unless item.umichpostaladdressdata.first.nil?
75
+ }
76
+ get_ldap_response(ldap)
77
+ end
74
78
 
75
- # GET THE E-MAIL ADDRESS FOR A SINGLE USER
76
- def LdapLookup.get_email(uniqname = nil)
77
- ldap = ldap_connection
78
- search_param = uniqname # the AD account goes here
79
- result_attrs = ["mail"] # Whatever you want to bring back in your result set goes here
80
- # Build filter
81
- search_filter = Net::LDAP::Filter.eq("uid", search_param)
82
- # Execute search
83
- ldap.search(filter: search_filter, attributes: result_attrs) { |item|
84
- return item.mail.first
85
- }
86
- get_ldap_response(ldap)
87
- end
79
+ # GET THE E-MAIL ADDRESS FOR A SINGLE USER
80
+ def self.get_email(uniqname = nil)
81
+ ldap = ldap_connection
82
+ search_param = uniqname # the AD account goes here
83
+ result_attrs = ["mail"] # Whatever you want to bring back in your result set goes here
84
+ # Build filter
85
+ search_filter = Net::LDAP::Filter.eq("uid", search_param)
86
+ # Execute search
87
+ ldap.search(filter: search_filter, attributes: result_attrs) { |item|
88
+ return item.mail.first
89
+ }
90
+ get_ldap_response(ldap)
91
+ end
88
92
 
89
- # ---------------------------------------------------------------------------------------------------------------------
90
- # Check if the UID is a member of an LDAP group. This function returns TRUE
91
- # if uid passed in is a member of group_name passed in. Otherwise it will
92
- # return false.
93
- def LdapLookup.is_member_of_group?(uid = nil, group_name = nil)
94
- ldap = ldap_connection
95
- # GET THE MEMBERS OF AN E-MAIL DISTRIBUTION LIST
96
- search_param = group_name # the name of the distribution list you're looking for goes here
97
- result_attrs = ["member"]
98
- # Build filter
99
- search_filter = Net::LDAP::Filter.eq("cn", search_param)
100
- group_filter = Net::LDAP::Filter.eq("objectClass", "group")
101
- composite_filter = Net::LDAP::Filter.join(search_filter, group_filter)
102
- # Execute search, extracting the AD account name from each member of the distribution list
103
- ldap.search(filter: composite_filter, attributes: result_attrs) do |item|
104
- item.member.each do |entry|
105
- if entry.split(",").first.split("=")[1] == uid
106
- return true
107
- end
93
+ # ---------------------------------------------------------------------------------------------------------------------
94
+ # Check if the UID is a member of an LDAP group. This function returns TRUE
95
+ # if uid passed in is a member of group_name passed in. Otherwise it will
96
+ # return false.
97
+ def self.is_member_of_group?(uid = nil, group_name = nil)
98
+ ldap = ldap_connection
99
+ # GET THE MEMBERS OF AN E-MAIL DISTRIBUTION LIST
100
+ search_param = group_name # the name of the distribution list you're looking for goes here
101
+ result_attrs = ["member"]
102
+ # Build filter
103
+ search_filter = Net::LDAP::Filter.eq("cn", search_param)
104
+ group_filter = Net::LDAP::Filter.eq("objectClass", "group")
105
+ composite_filter = Net::LDAP::Filter.join(search_filter, group_filter)
106
+ # Execute search, extracting the AD account name from each member of the distribution list
107
+ ldap.search(filter: composite_filter, attributes: result_attrs) do |item|
108
+ item.member.each do |entry|
109
+ if entry.split(",").first.split("=")[1] == uid
110
+ return true
108
111
  end
109
112
  end
110
- return FALSE
111
- get_ldap_response(ldap)
112
113
  end
114
+ return false
115
+ get_ldap_response(ldap)
116
+ end
113
117
 
114
- # ---------------------------------------------------------------------------------------------------------------------
115
- # Get the Name email and members of an LDAP group as a hash
116
- def LdapLookup.get_email_distribution_list(group_name = nil)
117
- ldap = ldap_connection
118
- result_hash = {}
119
- member_hash = {}
120
- # GET THE MEMBERS OF AN E-MAIL DISTRIBUTION LIST
121
- search_param = group_name # the name of the distribution list you're looking for goes here
122
- result_attrs = ["cn", LdapLookup.group_attribute, "member"]
123
- # Build filter
124
- search_filter = Net::LDAP::Filter.eq("cn", search_param)
125
- group_filter = Net::LDAP::Filter.eq("objectClass", "group")
126
- composite_filter = Net::LDAP::Filter.join(search_filter, group_filter)
127
- # Execute search, extracting the AD account name from each member of the distribution list
128
- ldap.search(filter: composite_filter, attributes: result_attrs) do |item|
129
- result_hash["group_name"] = item.cn.first
130
- result_hash["group_email"] = item.umichGroupEmail.first
131
- result_hash["members"] = item.member
118
+ # ---------------------------------------------------------------------------------------------------------------------
119
+ # Get the Name email and members of an LDAP group as a hash
120
+ def self.get_email_distribution_list(group_name = nil)
121
+ ldap = ldap_connection
122
+ result_hash = {}
123
+ member_hash = {}
124
+ # GET THE MEMBERS OF AN E-MAIL DISTRIBUTION LIST
125
+ search_param = group_name # the name of the distribution list you're looking for goes here
126
+ result_attrs = ["cn", group_attribute, "member"]
127
+ # Build filter
128
+ search_filter = Net::LDAP::Filter.eq("cn", search_param)
129
+ group_filter = Net::LDAP::Filter.eq("objectClass", "group")
130
+ composite_filter = Net::LDAP::Filter.join(search_filter, group_filter)
131
+ # Execute search, extracting the AD account name from each member of the distribution list
132
+ ldap.search(filter: composite_filter, attributes: result_attrs) do |item|
133
+ result_hash["group_name"] = item.cn.first
134
+ result_hash["group_email"] = item.umichGroupEmail.first
135
+ individual_array = []
136
+ item.member.each do |individual|
137
+ individual_array.push(individual.split(",").first.split("=")[1])
132
138
  end
133
- return result_hash
134
- get_ldap_response(ldap)
139
+ result_hash["members"] = individual_array.sort
140
+ end
141
+ return result_hash
142
+ get_ldap_response(ldap)
143
+ end
144
+
145
+ # ---------------------------------------------------------------------------
146
+ # Get the groups a user is a member of
147
+ def self.all_groups_for_user(uid = nil)
148
+ ldap = ldap_connection
149
+ result_array = []
150
+ result_attrs = ["dn"]
151
+ ldap.search(filter: "member=uid=#{uid},ou=People,dc=umich,dc=edu", attributes: result_attrs) do |item|
152
+ item.each { |key, value| result_array << value.first.split("=")[1].split(",")[0] }
135
153
  end
154
+ return result_array.sort
155
+ get_ldap_response(ldap)
136
156
  end
157
+ end
@@ -1,3 +1,3 @@
1
1
  module LdapLookup
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ldap_lookup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rick Smoke
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-04-10 00:00:00.000000000 Z
11
+ date: 2021-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,42 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.16'
19
+ version: 2.2.26
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.16'
26
+ version: 2.2.26
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '13.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '13.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 3.7.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 3.7.0
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: net-ldap
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - "~>"
46
60
  - !ruby/object:Gem::Version
47
- version: 0.16.1
61
+ version: 0.17.0
48
62
  type: :runtime
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
66
  - - "~>"
53
67
  - !ruby/object:Gem::Version
54
- version: 0.16.1
68
+ version: 0.17.0
55
69
  description: This module is to be used for anonymous lookup of attributes in the MCommunity
56
70
  service provide at the University of Michigan. It can be easily modifed to use other
57
71
  LDAP server configurations.
@@ -64,6 +78,7 @@ files:
64
78
  - ".gitignore"
65
79
  - CODE_OF_CONDUCT.md
66
80
  - Gemfile
81
+ - Gemfile.lock
67
82
  - LICENSE.txt
68
83
  - README.md
69
84
  - Rakefile
@@ -78,7 +93,7 @@ homepage: https://github.com/rsmoke/ldap_lookup.git
78
93
  licenses:
79
94
  - MIT
80
95
  metadata: {}
81
- post_install_message:
96
+ post_install_message:
82
97
  rdoc_options: []
83
98
  require_paths:
84
99
  - lib
@@ -93,9 +108,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
108
  - !ruby/object:Gem::Version
94
109
  version: '0'
95
110
  requirements: []
96
- rubyforge_project:
97
- rubygems_version: 2.7.2
98
- signing_key:
111
+ rubygems_version: 3.1.4
112
+ signing_key:
99
113
  specification_version: 4
100
114
  summary: For anonymous lookup of user LDAP attributes.
101
115
  test_files: []