ucb_groups 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/lib/ucb_groups/campus_group.rb +4 -3
- data/lib/ucb_groups/ldap_conn.rb +2 -2
- data/lib/ucb_groups/membership_finder.rb +1 -1
- data/lib/ucb_groups/version.rb +1 -1
- data/lib/ucb_groups.rb +4 -0
- data/spec/spec_helper.rb +1 -1
- data/spec/ucb_groups/campus_group_spec.rb +5 -3
- 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: 44afd05e9f0cda43ea10a6bc30255a8b3f44b199
|
4
|
+
data.tar.gz: ec73f0e642dc406795ac8565d3b7b010bb6b1a9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ba3c534c2a9cfce09ed164dc98e54f5a6bef9fcb2b2d084349ee1607fe2ca4365e140d1100e4601e5fde40d55069666f7cb77f1c4ffc39c5ba744e9a2680f8e
|
7
|
+
data.tar.gz: e6ba58c3607583394757680f4f7679df8bbb282241c676a03f963aa4d40d116675bd154dafabc70e122cd50099f09b4b209761821378cc38bead8c54ca951611
|
data/README.md
CHANGED
@@ -27,8 +27,10 @@ Then...
|
|
27
27
|
|
28
28
|
Get list of groups in namespace:
|
29
29
|
```
|
30
|
-
UcbGroups::CampusGroup.find(<namespace>)
|
30
|
+
groups = UcbGroups::CampusGroup.find(<namespace>)
|
31
31
|
=> [CampusGroup, CampusGroup, ...]
|
32
|
+
groups.first
|
33
|
+
=>
|
32
34
|
```
|
33
35
|
|
34
36
|
Find people in one or more groups:
|
@@ -1,18 +1,19 @@
|
|
1
1
|
module UcbGroups
|
2
2
|
class CampusGroup
|
3
|
-
attr_accessor :
|
3
|
+
attr_accessor :id, :name, :description, :namespace, :dn
|
4
4
|
|
5
5
|
def initialize(ldap_entry)
|
6
6
|
@dn = ldap_entry[:dn].first.to_s
|
7
7
|
@description = ldap_entry[:description].first.to_s
|
8
|
-
@
|
8
|
+
@name = ldap_entry[:displayName].first.to_s
|
9
|
+
@namespace, @id = parse_dn
|
9
10
|
end
|
10
11
|
|
11
12
|
def self.find(namespace)
|
12
13
|
args = {
|
13
14
|
:base => "ou=campus groups,dc=berkeley,dc=edu",
|
14
15
|
:filter => build_filter(namespace),
|
15
|
-
:attributes => %w(
|
16
|
+
:attributes => %w(name displayName description dn)
|
16
17
|
}
|
17
18
|
LdapConn.conn.search(args).map { |entry| CampusGroup.new(entry) }
|
18
19
|
end
|
data/lib/ucb_groups/ldap_conn.rb
CHANGED
@@ -8,10 +8,10 @@ module UcbGroups
|
|
8
8
|
raise(LdapBindFailedException)
|
9
9
|
end
|
10
10
|
|
11
|
-
def self.authenticate(username, password, host
|
11
|
+
def self.authenticate(username, password, host)
|
12
12
|
@username = username
|
13
13
|
@password = password
|
14
|
-
@host = host
|
14
|
+
@host = host || 'nds.berkeley.edu'
|
15
15
|
end
|
16
16
|
|
17
17
|
def self.authenticate_from_config(config_file)
|
data/lib/ucb_groups/version.rb
CHANGED
data/lib/ucb_groups.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -2,6 +2,6 @@ require_relative '../lib/ucb_groups'
|
|
2
2
|
require 'yaml'
|
3
3
|
|
4
4
|
RSpec.configure do |config|
|
5
|
-
ldap_yml = File.expand_path(File.
|
5
|
+
ldap_yml = File.expand_path(File.join(UcbGroups.root, "config", "ldap.yml"))
|
6
6
|
UcbGroups::LdapConn.authenticate_from_config(ldap_yml)
|
7
7
|
end
|
@@ -5,7 +5,8 @@ describe "CampusGroup" do
|
|
5
5
|
let(:entry) do
|
6
6
|
{
|
7
7
|
:dn => ["cn=edu:berkeley:app:calmessages:faculty,ou=campus groups,dc=berkeley,dc=edu"],
|
8
|
-
:description => ["Instructors"]
|
8
|
+
:description => ["UCB Instructors"],
|
9
|
+
:displayName => ["Instructors"]
|
9
10
|
}
|
10
11
|
end
|
11
12
|
|
@@ -17,9 +18,10 @@ describe "CampusGroup" do
|
|
17
18
|
it "initializes an entry" do
|
18
19
|
group = UcbGroups::CampusGroup.new(entry)
|
19
20
|
|
20
|
-
group.
|
21
|
+
group.id.should eql("faculty")
|
22
|
+
group.name.should eql("Instructors")
|
21
23
|
group.description.should eql(entry[:description].first)
|
22
24
|
group.namespace.should eql("calmessages")
|
23
|
-
group.
|
25
|
+
group.dn.should eql(entry[:dn].first)
|
24
26
|
end
|
25
27
|
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.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sahglie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|