ku-ldap 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -1
- data/lib/ku/ldap/entry/base.rb +5 -0
- data/lib/ku/ldap/entry/user.rb +10 -2
- data/lib/ku/ldap/version.rb +1 -1
- data/spec/ku/ldap/entry/user_spec.rb +7 -2
- metadata +2 -2
data/README.md
CHANGED
data/lib/ku/ldap/entry/base.rb
CHANGED
data/lib/ku/ldap/entry/user.rb
CHANGED
@@ -43,8 +43,16 @@ module KU
|
|
43
43
|
self[:mail]
|
44
44
|
end
|
45
45
|
|
46
|
-
def
|
47
|
-
self[:employeetype]
|
46
|
+
def primary_group
|
47
|
+
Group.new self[:employeetype]
|
48
|
+
end
|
49
|
+
|
50
|
+
def groups
|
51
|
+
@groups ||= KU::LDAP.groups(:memberuid, id, :eq)
|
52
|
+
end
|
53
|
+
|
54
|
+
def group_ids
|
55
|
+
groups.map(&:id)
|
48
56
|
end
|
49
57
|
|
50
58
|
private
|
data/lib/ku/ldap/version.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require_relative '../../../spec_helper'
|
2
2
|
require_relative '../../../../lib/ku/ldap/entry/user'
|
3
|
+
require_relative '../../../../lib/ku/ldap/entry/group'
|
3
4
|
|
4
5
|
describe KU::LDAP::Entry::User do
|
5
6
|
|
@@ -62,7 +63,7 @@ describe KU::LDAP::Entry::User do
|
|
62
63
|
attrs[:o] << 'primary_institution'
|
63
64
|
attrs[:departmentnumber] << 'department'
|
64
65
|
attrs[:mail] << 'email'
|
65
|
-
attrs[:employeetype] << '
|
66
|
+
attrs[:employeetype] << {cn: ['primary_group']}
|
66
67
|
attrs
|
67
68
|
end
|
68
69
|
|
@@ -70,10 +71,14 @@ describe KU::LDAP::Entry::User do
|
|
70
71
|
@user = subject.send :new, attributes
|
71
72
|
end
|
72
73
|
|
73
|
-
%w(id first_name last_name full_name title primary_institution department email
|
74
|
+
%w(id first_name last_name full_name title primary_institution department email).each do |attribute|
|
74
75
|
it "must return #{attribute}" do
|
75
76
|
@user.send(attribute.to_sym).must_equal attribute
|
76
77
|
end
|
77
78
|
end
|
79
|
+
|
80
|
+
it 'must return primary_group' do
|
81
|
+
@user.primary_group.must_equal KU::LDAP::Entry::Group.new(cn: ['primary_group'])
|
82
|
+
end
|
78
83
|
end
|
79
84
|
end
|
metadata
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
name: ku-ldap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- jamiehodge
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
prerelease: false
|