ucb_ldap 2.0.0.pre1 → 2.0.0.pre3
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 +7 -0
- data/.gitignore +21 -0
- data/CHANGELOG +137 -135
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/{README → README.md} +82 -80
- data/Rakefile +38 -20
- data/lib/ucb_ldap.rb +238 -204
- data/lib/{ucb_ldap_address.rb → ucb_ldap/address.rb} +106 -106
- data/lib/{ucb_ldap_affiliation.rb → ucb_ldap/affiliation.rb} +16 -16
- data/lib/{ucb_ldap_entry.rb → ucb_ldap/entry.rb} +455 -448
- data/lib/{ucb_ldap_person_job_appointment.rb → ucb_ldap/job_appointment.rb} +77 -79
- data/lib/{ucb_ldap_namespace.rb → ucb_ldap/namespace.rb} +40 -50
- data/lib/{ucb_ldap_org.rb → ucb_ldap/org.rb} +427 -429
- data/lib/{ucb_ldap_person.rb → ucb_ldap/person.rb} +157 -148
- data/lib/{person → ucb_ldap/person}/affiliation_methods.rb +23 -22
- data/lib/ucb_ldap/person/common_attributes.rb +63 -0
- data/lib/{ucb_ldap_schema.rb → ucb_ldap/schema.rb} +28 -28
- data/lib/{ucb_ldap_schema_attribute.rb → ucb_ldap/schema_attribute.rb} +152 -153
- data/lib/{ucb_ldap_service.rb → ucb_ldap/service.rb} +17 -19
- data/lib/{ucb_ldap_student_term.rb → ucb_ldap/student_term.rb} +29 -31
- data/lib/ucb_ldap/version.rb +3 -0
- data/spec/rails_binds.yml +9 -0
- data/spec/spec_helper.rb +43 -0
- data/spec/ucb_ldap/address_spec.rb +54 -0
- data/spec/ucb_ldap/affiliation_spec.rb +85 -0
- data/spec/ucb_ldap/entry_spec.rb +241 -0
- data/spec/ucb_ldap/job_appointment_spec.rb +65 -0
- data/spec/ucb_ldap/namespace_spec.rb +72 -0
- data/spec/ucb_ldap/org_spec.rb +217 -0
- data/spec/ucb_ldap/person_spec.rb +225 -0
- data/spec/ucb_ldap/schema_attribute_spec.rb +122 -0
- data/spec/ucb_ldap/schema_spec.rb +104 -0
- data/spec/ucb_ldap/service_spec.rb +127 -0
- data/spec/ucb_ldap/student_term_spec.rb +121 -0
- data/spec/ucb_ldap_spec.rb +182 -0
- data/ucb_ldap.gemspec +20 -27
- metadata +113 -64
- data/Manifest +0 -23
- data/TODO +0 -2
- data/lib/person/adv_con_person.rb +0 -0
- data/lib/person/generic_attributes.rb +0 -68
- data/lib/ucb_ldap_exceptions.rb +0 -27
- data/version.yml +0 -1
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 80b10ceb4a7cdc53a3f27dd0d6ee6d4c0612ab2a
|
4
|
+
data.tar.gz: b2114b162809fdb4061ae5342590c0e7bb1218a6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 764e80435a8f6f51ad3e8ad785239b7b460da025901f4c9266b2800dcb5f98c562f9105f5c89f829a9b4e093aaee99bb0a70af3089c48e2042006e7b7d12fe7f
|
7
|
+
data.tar.gz: 1f1a5747a32e69a44d196dcabc7135d02aea586b1876d7cdce079ad908b5fe4dc917c60beb94407f56dd027761aece85d9840753466305dbe4dff2b4c0d58b3e
|
data/.gitignore
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
*.iml
|
2
|
+
*.idea
|
3
|
+
.idea
|
4
|
+
*.gem
|
5
|
+
*.rbc
|
6
|
+
.bundle
|
7
|
+
.config
|
8
|
+
.yardoc
|
9
|
+
Gemfile.lock
|
10
|
+
InstalledFiles
|
11
|
+
_yardoc
|
12
|
+
coverage
|
13
|
+
doc/
|
14
|
+
lib/bundler/man
|
15
|
+
pkg
|
16
|
+
rdoc
|
17
|
+
spec/reports
|
18
|
+
test/tmp
|
19
|
+
test/version_tmp
|
20
|
+
tmp
|
21
|
+
spec/binds.yml
|
data/CHANGELOG
CHANGED
@@ -1,135 +1,137 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
*
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
*
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
*
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
* fixed
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
*
|
25
|
-
*
|
26
|
-
|
27
|
-
*
|
28
|
-
*
|
29
|
-
*
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
*
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
* added
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
*
|
49
|
-
*
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
*
|
58
|
-
*
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
* added
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
*
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
*
|
83
|
-
*
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
* Added
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
*
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
*
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
*
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
*
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
1
|
+
# UCB::LDAP Changelog
|
2
|
+
|
3
|
+
## Version 2.0.0.pre3, June 8, 2013
|
4
|
+
* Reorganize file layout
|
5
|
+
* Fix bug where credentials get switched when building org tree
|
6
|
+
* Update default ldap hosts to new ldap host names
|
7
|
+
|
8
|
+
## Version 2.0.0.pre1, April 4, 2012
|
9
|
+
* Switch from ruby-net-ldap to net-ldap (`UCB::LDAP` should now work with ruby-1.9.x)
|
10
|
+
|
11
|
+
## Version 1.4.2, August 3, 2010
|
12
|
+
* Remove hack that tried to persist the net-ldap connection instance as this cause problems
|
13
|
+
with leaving countless file descriptors open when run under JRuby.
|
14
|
+
* Updated bundled schema.yml file
|
15
|
+
|
16
|
+
## Version 1.2.1, January 22, 2008
|
17
|
+
|
18
|
+
* fixed bug: include `UCB::LDAP` call at top level that corrupted namespace
|
19
|
+
* fixed rspec tests to use production ldap server to verify Org structure
|
20
|
+
|
21
|
+
|
22
|
+
## Version 1.2.0, September 20, 2007
|
23
|
+
|
24
|
+
* fixed `UCB::LDAP::Person.student_not_registered?` which was broken
|
25
|
+
* added support for new entities
|
26
|
+
* Affiliation
|
27
|
+
* Service
|
28
|
+
* StudentTerm
|
29
|
+
* added handling of timestamp attributes
|
30
|
+
* various additions and clean-up to the various employee_*, student_*, affiliate_* methods
|
31
|
+
including handling of expiration
|
32
|
+
* fetches schema from url rather than file packaged with gem
|
33
|
+
* made `UCB::LDAP::Person` searches exclude test entries by default
|
34
|
+
* Rails applications can use `UCB::LDAP.bind_for_rails` to get environment-specific binds
|
35
|
+
|
36
|
+
## Version 1.1.1, August 2, 2007
|
37
|
+
|
38
|
+
* fixed bug around deleting LDAP entries.
|
39
|
+
|
40
|
+
## Version 1.1.0, August 1, 2007
|
41
|
+
|
42
|
+
* added Org#level_<n>_code and Org#level_<n>_name where <n> is 1-6. Returns the
|
43
|
+
org node's level "n" code/name
|
44
|
+
* added option to Org.flattened_tree() to restrict levels returned.
|
45
|
+
|
46
|
+
## Version 1.0.1, July 25, 2007
|
47
|
+
|
48
|
+
* do a better job trapping dropped connections in UCB::LDAP.connection_open?
|
49
|
+
* added Person#test? to check for test entries
|
50
|
+
|
51
|
+
## Version 1.0.0
|
52
|
+
|
53
|
+
* got complete schema info for attributes
|
54
|
+
* replaced attribute synonyms in favor of explicit methods
|
55
|
+
* added support for ldap updates
|
56
|
+
* added support for new entities (if your bind supports it):
|
57
|
+
* appointment
|
58
|
+
* address
|
59
|
+
|
60
|
+
## Version 0.8.1, May 18, 2007
|
61
|
+
|
62
|
+
* added Person#dept_org (synonym for Person#deptid)
|
63
|
+
* added Person#dept_name
|
64
|
+
|
65
|
+
## Version 0.8.0, April 27, 2007
|
66
|
+
|
67
|
+
* added support for privileged binds via UCB::LDAP::authenticate()
|
68
|
+
|
69
|
+
## Version 0.7.0, January 16, 2007
|
70
|
+
|
71
|
+
* updated: UCB::LDAP::Entry.search to use Net::LDAP::Filter objects: this fixed the
|
72
|
+
problem with embedded whitespace
|
73
|
+
* updated UCB::LDAP::Person.person_by_uid() to work with an Integer or a String
|
74
|
+
and UCB::LDAP::Person.persons_by_uids() to work with an Array of Integers or Strings.
|
75
|
+
* updated: UCB::LDAP::Person.student? to utilize the new LDAP v2 ou structure
|
76
|
+
* added: UCB::LDAP::Person.student_registered?, UCB::LDAP::Person.student_not_registered?
|
77
|
+
* deprecated: UCB::LDAP::Person.student_summer?, UCB::LDAP::Person.student_summer_only?,
|
78
|
+
UCB::LDAP::Person.spring?, UCB::LDAP::Person.fall?. Except for UCB::LDAP::Person.student_summer_only?,
|
79
|
+
these methods may be added in later versions of UCB::LDAP::Person. Note: accessing these
|
80
|
+
attributes will required a privileged bind.
|
81
|
+
* changed UCB::LDAP::Entry to only allow filter options in hash form: :filter => {:uid => 12345}
|
82
|
+
* updated documentations
|
83
|
+
* updated unit tests.
|
84
|
+
|
85
|
+
## Version 0.6.0, January 10, 2007
|
86
|
+
|
87
|
+
* Added loading/caching of all nodes
|
88
|
+
* Added calculation of all child nodes
|
89
|
+
* Added UCB::LDAP::Org.flattened_tree()
|
90
|
+
* Added UCB::LDAP::Person.org_node()
|
91
|
+
|
92
|
+
## Version 0.5.0, December 20, 2006
|
93
|
+
|
94
|
+
* Added following methods to Org:
|
95
|
+
* child_nodes
|
96
|
+
* parent_node
|
97
|
+
* parent_nodes
|
98
|
+
* persons
|
99
|
+
|
100
|
+
## Version 0.4.0, December 14, 2006
|
101
|
+
|
102
|
+
* Added Person.persons_by_uids to return array of Person for given
|
103
|
+
array of uids.
|
104
|
+
* Changed implementation of Person.person_by_uid to use new Person.persons_by_uid.
|
105
|
+
|
106
|
+
## Version 0.3.1, December 13, 2006
|
107
|
+
|
108
|
+
* Added SchemaAttribute class and methods to load schema
|
109
|
+
attributes in UCB::LDAP. Did not make use of the schema
|
110
|
+
attributes.
|
111
|
+
|
112
|
+
## Version 0.3.0, October 20, 2006
|
113
|
+
|
114
|
+
* Moved to SVN
|
115
|
+
* Reorganized doc directory
|
116
|
+
|
117
|
+
## Version 0.2.2, October 12, 2006
|
118
|
+
|
119
|
+
* Made more "booleans" actually return <tt>true</tt> and <tt>false</tt>
|
120
|
+
rather than expressions that evaluate to <tt>true</tt> and <tt>false</tt>.
|
121
|
+
* Some documentation updates.
|
122
|
+
|
123
|
+
## Version 0.2.1, October 10, 2006
|
124
|
+
|
125
|
+
* Changed module name and namespace from UcbLdap to UCB::LDAP.
|
126
|
+
* Fixed so UCB::LDAP::Entry and subclasses can be marshalled,
|
127
|
+
otherwise can't store in a Rails session.
|
128
|
+
|
129
|
+
## Version 0.2.0, October 9, 2006
|
130
|
+
|
131
|
+
* Packaged as a Ruby Gem.
|
132
|
+
* Converted underlying code to use Net::LDAP instead of LDAP.
|
133
|
+
* Added support for searching the org unit tree.
|
134
|
+
|
135
|
+
## Version 0.1.0, October 5, 2006
|
136
|
+
|
137
|
+
* Initial release.
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 sahglie
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/{README → README.md}
RENAMED
@@ -1,80 +1,82 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
UCB::LDAP is a wrapper module around Net::LDAP intended to simplify searching the UC Berkeley
|
4
|
-
LDAP directory: http://directory.berkeley.edu
|
5
|
-
|
6
|
-
|
7
|
-
If you are blissfully ignorant of LDAP, you should familiarize yourself with some of the basics.
|
8
|
-
Here is a great online resource: http://www.zytrax.com/books/ldap
|
9
|
-
|
10
|
-
The RDoc for the ruby-net-ldap Gem (http://rubyfurnace.com/docs/ruby-net-ldap-0.0.4/classes/Net/LDAP.html) also has a good introduction to LDAP.
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
Search the directory specifying tree base and
|
18
|
-
|
19
|
-
|
20
|
-
entries = UCB::LDAP.search(:base => "ou=people,dc=berkeley,dc=edu", :filter => {:uid => 123}
|
21
|
-
|
22
|
-
entry.
|
23
|
-
entry.
|
24
|
-
|
25
|
-
|
26
|
-
See UCB::LDAP::Entry for more information.
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
Search the Person tree getting back UCB::LDAP::Person instances:
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
person.firstname #=> "John"
|
35
|
-
person.affiliations #=> ['EMPLOYEE-TYPE-STAFF']
|
36
|
-
person.employee? #=> true
|
37
|
-
person.employee_staff? #=> true
|
38
|
-
person.employee_academic? #=> false
|
39
|
-
person.student? #=> false
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
dept.
|
50
|
-
dept.
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
UCB::LDAP.
|
63
|
-
p
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
1
|
+
#UC Berkeley LDAP
|
2
|
+
|
3
|
+
UCB::LDAP is a wrapper module around Net::LDAP intended to simplify searching the UC Berkeley
|
4
|
+
LDAP directory: http://directory.berkeley.edu
|
5
|
+
|
6
|
+
##Introduction to LDAP
|
7
|
+
If you are blissfully ignorant of LDAP, you should familiarize yourself with some of the basics.
|
8
|
+
Here is a great online resource: http://www.zytrax.com/books/ldap
|
9
|
+
|
10
|
+
The RDoc for the ruby-net-ldap Gem (http://rubyfurnace.com/docs/ruby-net-ldap-0.0.4/classes/Net/LDAP.html) also has a good introduction to LDAP.
|
11
|
+
|
12
|
+
|
13
|
+
##Examples
|
14
|
+
|
15
|
+
###General Search
|
16
|
+
|
17
|
+
Search the directory specifying tree base and filter, getting back generic `UCB::LDAP::Entry` instances:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
entries = UCB::LDAP.search(:base => "ou=people,dc=berkeley,dc=edu", :filter => {:uid => 123})
|
21
|
+
entry.uid #=> '123'
|
22
|
+
entry.givenname #=> 'John'
|
23
|
+
entry.sn #=> 'Doe'
|
24
|
+
```
|
25
|
+
|
26
|
+
See `UCB::LDAP::Entry` for more information.
|
27
|
+
|
28
|
+
###Person Search
|
29
|
+
|
30
|
+
Search the Person tree getting back UCB::LDAP::Person instances:
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
person = UCB::LDAP::Person.find_by_uid("123")
|
34
|
+
person.firstname #=> "John"
|
35
|
+
person.affiliations #=> ['EMPLOYEE-TYPE-STAFF']
|
36
|
+
person.employee? #=> true
|
37
|
+
person.employee_staff? #=> true
|
38
|
+
person.employee_academic? #=> false
|
39
|
+
person.student? #=> false
|
40
|
+
```
|
41
|
+
|
42
|
+
See `UCB::LDAP::Person` for more information.
|
43
|
+
|
44
|
+
###Org Unit Search
|
45
|
+
|
46
|
+
Search the Org Unit tree getting back `UCB::LDAP::Org` instances:
|
47
|
+
|
48
|
+
``` ruby
|
49
|
+
dept = UCB::LDAP::Org.org_by_ou('jkasd')
|
50
|
+
dept.deptid #=> "JKASD"
|
51
|
+
dept.name #=> "Administrative Systems Dept"
|
52
|
+
```
|
53
|
+
|
54
|
+
See `UCB::LDAP::Org` for more information.
|
55
|
+
|
56
|
+
###Privileged Binds
|
57
|
+
|
58
|
+
If you want access the directory anonymously, no credentials are required.
|
59
|
+
If you want to access via a privileged bind, authenticate before querying:
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
p = UCB::LDAP::Person.find_by_uid("123")
|
63
|
+
p.non_public_attr #=> NoMethodError
|
64
|
+
|
65
|
+
UCB::LDAP.authenticate("mybind", "mypassword")
|
66
|
+
p = UCB::LDAP::Person.find_by_uid("123")
|
67
|
+
p.non_public_attr #=> "some value"
|
68
|
+
```
|
69
|
+
|
70
|
+
###Privileged Binds and Rails
|
71
|
+
|
72
|
+
See `UCB::LDAP.bind_for_rails`
|
73
|
+
|
74
|
+
##Dependencies
|
75
|
+
|
76
|
+
* Net::LDAP
|
77
|
+
* Ruby 1.9.2 or better
|
78
|
+
|
79
|
+
##Maintainers
|
80
|
+
|
81
|
+
* Steven Hansen
|
82
|
+
* Steve Downey
|