ucb_groups 0.0.7 → 0.0.8

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
  SHA1:
3
- metadata.gz: f043f60d47d06ac9784377d91f42ab15efcc96db
4
- data.tar.gz: 7260b09220253c01c0acd2e610a245a2259425a0
3
+ metadata.gz: 8a1c5751bd7d0cd52a43f821bfab1ceb96d95e4b
4
+ data.tar.gz: ba5e2a7dedb493d49c526e555f8c3f59447de177
5
5
  SHA512:
6
- metadata.gz: 6266d83c93e0e115cdff01c31f4aaac49e9f6c7ef00384e922ea622f198f8db5325b6e1522191ac907906d2a5b27f26121aa96622858caa054085d00b282c0c5
7
- data.tar.gz: 35cba662be0566a36dadc04684cd8616474a8e37f16a32cf082ccfceeed6ee37dd7b2e981aac9965364c5429f1fde5f8c3a4e56845e3d63732f549fca93cd656
6
+ metadata.gz: 107f2e3bbb3edcc37df8916a82ae76e5d384f69f3115d8617e2f655218915582c40e5f5b1fb7c8b68419b5b1023a6f087f25276541cbca3ab3fa4c2c7db08853
7
+ data.tar.gz: 9451a7d4426cd76a4a087ded3c82d1ae555f15b6f3c6e9382d7e8300311d1dc8024b66f3cf810b564583a45428a9326ec8dba1240e7526c3e388228d25d6506d
data/README.md CHANGED
@@ -52,8 +52,10 @@ person.first_name
52
52
  => "Joe"
53
53
  person.last_name
54
54
  => "Smith"
55
- person.email
56
- => "email@berkeley.edu"
55
+ person.public_email
56
+ => "email-public@berkeley.edu"
57
+ person.official_email
58
+ => "email-official@berkeley.edu"
57
59
  person.orgs
58
60
  => "UCBKL-SCHOL-SCHSW-CSDEP"
59
61
  ```
@@ -4,8 +4,8 @@ module UcbGroups
4
4
 
5
5
  def initialize(ldap_entry)
6
6
  @dn = ldap_entry[:dn].first.to_s
7
- @description = ldap_entry[:description].first.to_s
8
7
  @name = ldap_entry[:displayName].first.to_s
8
+ @description = ldap_entry[:description].first.to_s
9
9
  @namespace, @id = parse_dn
10
10
  end
11
11
 
@@ -6,7 +6,8 @@ module UcbGroups
6
6
  :uid => :uid,
7
7
  :first_name => :givenname,
8
8
  :last_name => :sn,
9
- :email => :mail,
9
+ :public_email => :mail,
10
+ :official_email => :ucbemail,
10
11
  :orgs => :berkeleyEduPrimaryDeptUnitHierarchyString
11
12
  }.freeze
12
13
 
@@ -1,3 +1,3 @@
1
1
  module UcbGroups
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -4,13 +4,13 @@ require_relative "../spec_helper"
4
4
  describe "CampusGroup" do
5
5
  let(:entry) do
6
6
  {
7
- :dn => ["cn=edu:berkeley:app:calmessages:faculty,ou=campus groups,dc=berkeley,dc=edu"],
8
- :description => ["UCB Instructors"],
9
- :displayName => ["Instructors"]
7
+ :dn => ["cn=edu:berkeley:app:calmessages:calmessages-test,ou=campus groups,dc=berkeley,dc=edu"],
8
+ :description => ["Calmessages Test"],
9
+ :displayName => ["calmessages-test"]
10
10
  }
11
11
  end
12
12
 
13
- it "Finds Campus Groups" do
13
+ it "finds all groups within a namespace" do
14
14
  groups = UcbGroups::CampusGroup.find(:calmessages)
15
15
  groups.should_not be_empty
16
16
  end
@@ -18,8 +18,8 @@ describe "CampusGroup" do
18
18
  it "initializes an entry" do
19
19
  group = UcbGroups::CampusGroup.new(entry)
20
20
 
21
- group.id.should eql("faculty")
22
- group.name.should eql("Instructors")
21
+ group.id.should eql("calmessages-test")
22
+ group.name.should eql(entry[:displayName].first)
23
23
  group.description.should eql(entry[:description].first)
24
24
  group.namespace.should eql("calmessages")
25
25
  group.dn.should eql(entry[:dn].first)
@@ -22,7 +22,7 @@ describe "MembershipFinder" do
22
22
  end
23
23
 
24
24
  it "finds users in a multiple groups" do
25
- finder.find(:groups => [:deans, :instructors]).should_not be_empty
25
+ finder.find(:groups => [:deans, 'calmessages-test']).should_not be_empty
26
26
  end
27
27
  end
28
28
 
@@ -41,12 +41,16 @@ describe "MembershipFinder" do
41
41
 
42
42
  context "Finding by group and org" do
43
43
  it "finds users in a single group and org" do
44
- campus_it_staff = finder.find(:groups => ["it-staff"])
45
- ist_it_staff = finder.find(:groups => ["it-staff"], :orgs => [:VRIST])
44
+ # Note, the memebers in these two groups may change over time, but it shouldn't
45
+ # happen very often. Test will need to be updated when groups members are changed
46
46
 
47
- campus_it_staff.should_not be_empty
48
- ist_it_staff.should_not be_empty
49
- (ist_it_staff.length < campus_it_staff.length).should be_true
47
+ testers = finder.find(:groups => ['calmessages-test'])
48
+ names = testers.map(&:first_name)
49
+ names.should =~ ["Sondra", "Veronica", "Steven", "Jeff", "Elise", "Cindy", "Annika"]
50
+
51
+ jlstp_testers = finder.find(:groups => ['calmessages-test'], :orgs => [:JLSTP])
52
+ jlstp_names = jlstp_testers.map(&:first_name)
53
+ jlstp_names.should =~ ["Sondra", "Jeff", "Veronica"]
50
54
  end
51
55
  end
52
56
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ucb_groups
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - sahglie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-03 00:00:00.000000000 Z
11
+ date: 2013-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -128,7 +128,6 @@ files:
128
128
  - lib/ucb_groups/monkey_patches/net_ldap_filter.rb
129
129
  - lib/ucb_groups/person.rb
130
130
  - lib/ucb_groups/version.rb
131
- - spec/integration/calmsgs_groups_spec.rb
132
131
  - spec/spec_helper.rb
133
132
  - spec/ucb_groups/campus_group_spec.rb
134
133
  - spec/ucb_groups/membership_filter_spec.rb
@@ -155,15 +154,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
154
  version: '0'
156
155
  requirements: []
157
156
  rubyforge_project:
158
- rubygems_version: 2.0.3
157
+ rubygems_version: 2.0.6
159
158
  signing_key:
160
159
  specification_version: 4
161
160
  summary: Finds users that belong to a given ucb group
162
161
  test_files:
163
- - spec/integration/calmsgs_groups_spec.rb
164
162
  - spec/spec_helper.rb
165
163
  - spec/ucb_groups/campus_group_spec.rb
166
164
  - spec/ucb_groups/membership_filter_spec.rb
167
165
  - spec/ucb_groups/membership_finder_spec.rb
168
166
  - spec/ucb_groups_spec.rb
169
- has_rdoc:
@@ -1,127 +0,0 @@
1
- require 'rest-client'
2
- require_relative "../spec_helper"
3
- require 'set'
4
-
5
- #groups = UcbGroups::CampusGroup.find(:calmessages)
6
- #pp groups.map(&:name).sort
7
-
8
-
9
- def assert_matching_group(group)
10
- @finder ||= UcbGroups::MembershipFinder.new(:calmessages)
11
- grouper_uids = @finder.find(:groups => [group]).map(&:uid).sort
12
- calmsgs_uids = calmsgs_group_uids(group)
13
-
14
- #if calmsgs_uids.length != grouper_uids.length
15
- puts "calmsgs: #{calmsgs_uids.length}, grouper: #{grouper_uids.length}"
16
- puts "Only In Calmsgs: #{calmsgs_uids - grouper_uids}\nOnly in Grouper: #{grouper_uids - calmsgs_uids}"
17
- grouper_uids.length.should eql(calmsgs_uids.length)
18
- #end
19
-
20
- calmsgs_uids.should eql(grouper_uids)
21
- end
22
-
23
- def calmsgs_group_uids(group)
24
- uids = RestClient.get("localhost:3000/api/groups/#{group}.json")
25
- JSON.parse(uids).map(&:to_s).sort
26
- end
27
-
28
-
29
- describe "Calmsgs Groups Compatibility" do
30
- it "academic-senate-faculty" do
31
- # fails but close enough
32
- assert_matching_group("academic-senate-faculty")
33
- end
34
-
35
- it "deans" do
36
- # fails but close enough
37
- assert_matching_group("deans")
38
- end
39
-
40
- it "dept-admin" do
41
- # fails because ldap does not keep emptititlecode around for expired people and caldap does (close enough)
42
- assert_matching_group("dept-admin")
43
- end
44
-
45
- it "dept-chairs" do
46
- # fails but close enough
47
- assert_matching_group("dept-chairs")
48
- end
49
-
50
- it "directors" do
51
- assert_matching_group("directors")
52
- end
53
-
54
- it "emeriti" do
55
- assert_matching_group("emeriti")
56
- end
57
-
58
- it "faculty" do
59
- # fails because calmsgs is grabbing people that it shouldn't. In many instances calmsgs
60
- # is grabbing staff that have no academic affiliation (close enough)
61
- assert_matching_group("faculty")
62
- end
63
-
64
- it "it-staff" do
65
- # fails because calmsgs it grabbing retired or expired it-staff (close enough)
66
- assert_matching_group("it-staff")
67
- end
68
-
69
- it "staff" do
70
- # fails but close enough
71
- assert_matching_group("staff")
72
- end
73
-
74
- it "students" do
75
- # fails but close enough
76
- assert_matching_group("students")
77
- end
78
-
79
- it "managers" do
80
- assert_matching_group("managers") # fails but close enough
81
- end
82
-
83
- it "supervisors" do
84
- assert_matching_group("supervisors") # fails but close enough
85
- end
86
-
87
- it "affiliates" do
88
- assert_matching_group("affiliates") # fails
89
- end
90
-
91
- it "ucop" do
92
- # fails but close enough
93
- assert_matching_group("ucop")
94
- end
95
-
96
- it "graduate-students" do
97
- # no calmsgs group
98
- # assert_matching_group("graduate-students")
99
- end
100
-
101
- it "advisors" do
102
- # no calmsgs group
103
- # assert_matching_group("advisors")
104
- end
105
-
106
- it "gsis" do
107
- # no calmsgs group
108
- # assert_matching_group("gsis")
109
- end
110
-
111
- it "gsrs" do
112
- # no calmsgs group
113
- # assert_matching_group("gsrs")
114
- end
115
-
116
- it "instructors" do
117
- # no calmsgs group
118
- #assert_matching_group("instructors")
119
- end
120
-
121
- it "undergrad-students" do
122
- # no calmsgs group
123
- # assert_matching_group("undergrad-students")
124
- end
125
- end
126
-
127
-