yaleldap 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +41 -20
- data/lib/yaleldap/version.rb +1 -1
- data/lib/yaleldap.rb +3 -2
- 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: 266a897095f24d430477b8e2102ddca166d36690
|
4
|
+
data.tar.gz: 92930d2a050274ed5875518dc3ddcd26196f1309
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c4904fd23614ad5461bf4fe3cd249a69e76b42c202b3f82e269875bd83db4f331f8a4c43127d655d1059a43d523ef76bbda1eb48996af031f8ae398959f9a7d
|
7
|
+
data.tar.gz: a9d1d6491b2dc918971d6087a339aede227e0e9dbd5b0813c893e491da60181489266c61aaf29b68588e1bc0a3a87263ad9bd932ce744adcf4e666774f3c9f4e
|
data/README.md
CHANGED
@@ -25,34 +25,48 @@ Or install it yourself as:
|
|
25
25
|
|
26
26
|
$ gem install yaleldap
|
27
27
|
|
28
|
-
|
28
|
+
To play with it, open `irb` and try these:
|
29
29
|
|
30
|
-
###UPI
|
31
30
|
```
|
32
|
-
|
33
|
-
|
31
|
+
require 'yaleldap'
|
32
|
+
attributes = YaleLDAP.lookup(netid: "csw3")
|
33
|
+
attributes = YaleLDAP.lookup(email: "casey.watts@yale.edu")
|
34
|
+
attributes = YaleLDAP.lookup(upi: "12714662")
|
34
35
|
```
|
35
36
|
|
37
|
+
|
38
|
+
## Usage
|
39
|
+
|
36
40
|
###NetID
|
37
41
|
```
|
38
42
|
YaleLDAP.lookup(netid: "csw3")
|
39
|
-
=> {:first_name=>"Casey", :nickname=>"", :last_name=>"Watts", :upi=>"12714662", :netid=>"csw3", :email=>"casey.watts@yale.edu", :
|
43
|
+
=> {:first_name=>"Casey", :nickname=>"", :last_name=>"Watts", :upi=>"12714662", :netid=>"csw3", :email=>"casey.watts@yale.edu", :title=>"Assistant Manager", :division=>"Information Technology Services", :school=>"Information Technology Services", :school_abbreviation=>"", :organization=>"ITSCCT Web Technologies", :major=>"", :curriculum=>"", :college_name=>"", :college_abbreviation=>"", :class_year=>"", :telephone=>"203-436-5986", :address=>"ITS Student Technology Collaborative\nPO BOX 208300\nNew Haven, CT 06520-8300"}
|
40
44
|
```
|
41
45
|
|
42
46
|
###Email
|
43
47
|
```
|
44
48
|
YaleLDAP.lookup(email: "casey.watts@yale.edu")
|
45
|
-
=> {:first_name=>"Casey", :nickname=>"", :last_name=>"Watts", :upi=>"12714662", :netid=>"csw3", :email=>"casey.watts@yale.edu", :
|
49
|
+
=> {:first_name=>"Casey", :nickname=>"", :last_name=>"Watts", :upi=>"12714662", :netid=>"csw3", :email=>"casey.watts@yale.edu", :title=>"Assistant Manager", :division=>"Information Technology Services", :school=>"Information Technology Services", :school_abbreviation=>"", :organization=>"ITSCCT Web Technologies", :major=>"", :curriculum=>"", :college_name=>"", :college_abbreviation=>"", :class_year=>"", :telephone=>"203-436-5986", :address=>"ITS Student Technology Collaborative\nPO BOX 208300\nNew Haven, CT 06520-8300"}
|
50
|
+
```
|
51
|
+
|
52
|
+
###UPI
|
53
|
+
```
|
54
|
+
YaleLDAP.lookup(upi: "12714662")
|
55
|
+
=> {:first_name=>"Casey", :nickname=>"", :last_name=>"Watts", :upi=>"12714662", :netid=>"csw3", :email=>"casey.watts@yale.edu", :title=>"Assistant Manager", :division=>"Information Technology Services", :school=>"Information Technology Services", :school_abbreviation=>"", :organization=>"ITSCCT Web Technologies", :major=>"", :curriculum=>"", :college_name=>"", :college_abbreviation=>"", :class_year=>"", :telephone=>"203-436-5986", :address=>"ITS Student Technology Collaborative\nPO BOX 208300\nNew Haven, CT 06520-8300"}
|
46
56
|
```
|
47
57
|
|
58
|
+
|
48
59
|
## Return Data
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
-
|
60
|
+
###What data is returned?
|
61
|
+
>"What does the returned data look like? Where does it come from?"
|
62
|
+
|
63
|
+
We map a memorable nickname to each of the less memorable formal LDAP names.
|
64
|
+
- The easiest way to see what attributes are available is to test it out.
|
65
|
+
- Our full list of nicknames is in `lib/yaleldap.rb` under `self.nicknames`
|
66
|
+
- Yale's list of formal LDAP attribute names are listed [here](http://directory.yale.edu/phonebook/help.htm).
|
67
|
+
- Here are some examples of what the more vague LDAP terms contain. We've included multiple aliases for some of these.
|
54
68
|
```
|
55
|
-
Division
|
69
|
+
Division [listed as division, school] - general category, most people have this. For students, this is their school)
|
56
70
|
Yale College
|
57
71
|
Graduate School of Arts & Sci
|
58
72
|
Architecture School
|
@@ -60,23 +74,30 @@ Division (general, most people have this)
|
|
60
74
|
MYSM School Of Medicine
|
61
75
|
Information Technology Services
|
62
76
|
|
63
|
-
|
77
|
+
Curriculum Code [listed as school_abbreviation] - seems to be abbreviation of division if they are a school?)
|
78
|
+
YC
|
79
|
+
GS
|
80
|
+
AC
|
81
|
+
|
82
|
+
Organization [listed as organization] - more specific, staff tend to have these
|
64
83
|
MPHARM Administration
|
65
84
|
ITSCCT Web Technologies
|
66
85
|
|
67
|
-
Curriculum/Major
|
86
|
+
Curriculum/Major [listed as curriculum, major] - more specific, students tend to have these
|
68
87
|
Pharmacology
|
69
88
|
Architecture School
|
70
89
|
Physics
|
71
|
-
|
72
|
-
Curriculum Code (seems to be abbreviation of division if they are a school?)
|
73
|
-
YC
|
74
|
-
GS
|
75
|
-
AC
|
76
90
|
```
|
77
91
|
|
92
|
+
### Something's Missing?
|
93
|
+
>"I want some data that's in the [Yale Phonebook](http://directory.yale.edu/phonebook/index.htm) but it's not in the `YaleLDAP` gem."
|
94
|
+
|
95
|
+
- If you think there is a commonly used field we missed, file a github issue! :D
|
96
|
+
- If you'd like more control over your YaleLDAP connection, you could do this all manually. [Here is a gist](https://gist.github.com/caseywatts/ddea3996853050d1e5ad) of how to use the 'net-ldap' gem to access Yale's LDAP.
|
97
|
+
|
98
|
+
|
78
99
|
## Use in Rails
|
79
|
-
You can use an "after_create" filter to have these attributes filled out after the user is created (maybe after first login if that's how your app works). `.slice(:first_name, :last_name, :netid)` will extract only the attributes you want to save to ActiveRecord. If your database uses diferent names you will have to rename the appropriate attributes manually
|
100
|
+
You can use an "after_create" filter to have these attributes filled out after the user is created (maybe after first login if that's how your app works). `.slice(:first_name, :last_name, :netid)` will extract only the attributes you want to save to ActiveRecord. If your database uses diferent names you will have to rename the appropriate attributes manually using your own ruby code.
|
80
101
|
```
|
81
102
|
class User < ActiveRecord::Base
|
82
103
|
after_create :get_ldap_attributes
|
data/lib/yaleldap/version.rb
CHANGED
data/lib/yaleldap.rb
CHANGED
@@ -68,8 +68,8 @@ private
|
|
68
68
|
"school" => "o",
|
69
69
|
"school_abbreviation" => "curriculumshortname",
|
70
70
|
"organization" => "ou",
|
71
|
-
"major" => "
|
72
|
-
"curriculum" => "
|
71
|
+
"major" => "major",
|
72
|
+
"curriculum" => "major",
|
73
73
|
"college_name" => "collegename",
|
74
74
|
"college_abbreviation" => "college",
|
75
75
|
"class_year" => "class",
|
@@ -110,6 +110,7 @@ private
|
|
110
110
|
|
111
111
|
def self.extract_attributes(ldap_response)
|
112
112
|
attributes = {}
|
113
|
+
binding.pry
|
113
114
|
nicknames.each do |nickname, ldapname|
|
114
115
|
attribute = extract_attribute(ldap_response, ldapname)
|
115
116
|
attribute = attribute.gsub(/\$/,"\n") #for address
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yaleldap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- caseywatts
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|