ku-ldap 0.0.1

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.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ku-ldap.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Copenhagen University
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.md ADDED
@@ -0,0 +1,88 @@
1
+ # KU::LDAP
2
+
3
+ A client for the Copenhagen University LDAP service.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'ku-ldap'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install ku-ldap
18
+
19
+ ## Usage
20
+
21
+ ### Users
22
+
23
+ Find a user by ID:
24
+
25
+ KU::LDAP.user 'abc123'
26
+
27
+ Search for users with an attribute matching a given string:
28
+
29
+ KU::LDAP.users :givenname, 'foo'
30
+
31
+ The matcher is an optional argument (default `:contains`):
32
+
33
+ KU::LDAP.users :givenname, 'oo', :ends
34
+
35
+ Available matchers:
36
+
37
+ :begins, :contains, :ends, :eq
38
+
39
+ Find and authenticate a user by ID and password:
40
+
41
+ KU::LDAP.authenticate_user 'abc123', 'password'
42
+
43
+ User metadata:
44
+
45
+ user = KU::LDAP.user 'abc123'
46
+ user.id
47
+ user.first_name
48
+ user.last_name
49
+ user.full_name
50
+ user.title
51
+ user.primary_institution
52
+ user.department
53
+ user.email
54
+ user.group_name
55
+
56
+ ### Groups
57
+
58
+ Find a group by name:
59
+
60
+ KU::LDAP.group 'foo'
61
+
62
+ Search for groups with an attribute containing a given string:
63
+
64
+ KU::LDAP.groups :description, 'foo'
65
+
66
+ Or, with an alternate matcher:
67
+
68
+ KU::LDAP.groups :description, 'foo', :begins
69
+
70
+ Group metadata:
71
+
72
+ group = KU::LDAP.group 'foo'
73
+ group.id
74
+ group.description
75
+ group.primary_institution
76
+ group.members
77
+
78
+ Group membership:
79
+
80
+ group.member? 'abc123'
81
+
82
+ ## Contributing
83
+
84
+ 1. Fork it
85
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
86
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
87
+ 4. Push to the branch (`git push origin my-new-feature`)
88
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
data/ku-ldap.gemspec ADDED
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/ku/ldap/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["jamiehodge"]
6
+ gem.email = ["jamiehodge@me.com"]
7
+ gem.description = %q{A client for the Copenhagen University LDAP service.}
8
+ gem.summary = %q{A client for the Copenhagen University LDAP service.}
9
+ gem.homepage = ""
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "ku-ldap"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = KU::LDAP::VERSION
17
+
18
+ gem.add_dependency 'net-ldap'
19
+ end
data/lib/ku/ldap.rb ADDED
@@ -0,0 +1,45 @@
1
+ require 'net/ldap'
2
+
3
+ require_relative 'ldap/directory'
4
+ require_relative 'ldap/entry'
5
+ require_relative 'ldap/version'
6
+
7
+ module KU
8
+ module LDAP
9
+ extend self
10
+
11
+ HOST = ENV['KU_LDAP_HOST']
12
+ PORT = ENV['KU_LDAP_PORT']
13
+
14
+ def user id, user_class=Entry::User
15
+ user_class.first directory, id
16
+ end
17
+
18
+ def users attribute, value, matcher=:contains, user_class=Entry::User
19
+ user_class.search directory, attribute.to_sym, value, matcher
20
+ end
21
+
22
+ def authenticate_user id, password, user_class=Entry::User
23
+ user_class.authenticate directory, id, password
24
+ end
25
+
26
+ def group id, group_class=Entry::Group
27
+ group_class.first directory, id
28
+ end
29
+
30
+ def groups attribute, value, matcher=:contains, group_class=Entry::Group
31
+ group_class.search directory, attribute.to_sym, value, matcher
32
+ end
33
+
34
+ private
35
+
36
+ def directory
37
+ Directory.new service
38
+ end
39
+
40
+ def service
41
+ Net::LDAP.new(host: HOST, port: PORT, encryption: :start_tls)
42
+ end
43
+ end
44
+ end
45
+
@@ -0,0 +1,31 @@
1
+ module KU
2
+ module LDAP
3
+ class Directory
4
+
5
+ def initialize service
6
+ @service = service
7
+ @service.authenticate *credentials if credentials
8
+ end
9
+
10
+ def first base, filter
11
+ search(base, filter).first if @service.bind
12
+ end
13
+
14
+ def search base, filter
15
+ @service.search(base: base, filter: filter)
16
+ end
17
+
18
+ def authenticate base, filter, password
19
+ @service.bind_as(base: base, filter: filter, password: password)
20
+ end
21
+
22
+ private
23
+
24
+ def credentials
25
+ return unless ENV['KU_LDAP_USERNAME'] && ENV['KU_LDAP_PASSWORD']
26
+ [ENV['KU_LDAP_USERNAME'], ENV['KU_LDAP_PASSWORD']]
27
+ end
28
+ end
29
+ end
30
+ end
31
+
@@ -0,0 +1,2 @@
1
+ require_relative 'entry/user'
2
+ require_relative 'entry/group'
@@ -0,0 +1,42 @@
1
+ require_relative '../filter'
2
+
3
+ module KU
4
+ module LDAP
5
+ module Entry
6
+ class Base
7
+
8
+ BASE = ENV['KU_LDAP_BASE'] || 'dc=sc,dc=ku,dc=dk'
9
+
10
+ def self.first directory, id, filter=Filter.new
11
+ entry = directory.first base, filter.eq(identifier, id)
12
+ new entry if entry
13
+ end
14
+
15
+ def self.search directory, attribute, value, matcher, filter=Filter.new
16
+ filt = filter.send matcher.to_sym, attribute, value
17
+ Array(directory.search(base, filt)).map {|entry| new entry}
18
+ end
19
+
20
+ def initialize entry
21
+ @entry = entry || Hash.new([])
22
+ end
23
+
24
+ private
25
+
26
+ def self.base
27
+ BASE
28
+ end
29
+
30
+ def self.identifier
31
+ :dn
32
+ end
33
+
34
+ def [] attribute
35
+ @entry[attribute].first
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+
42
+
@@ -0,0 +1,38 @@
1
+ require_relative 'base'
2
+
3
+ module KU
4
+ module LDAP
5
+ module Entry
6
+ class Group < Base
7
+
8
+ def id
9
+ self[:cn]
10
+ end
11
+
12
+ def description
13
+ self[:description]
14
+ end
15
+
16
+ def members
17
+ @entry[:memberuid]
18
+ end
19
+
20
+ def member? id
21
+ members.include? id
22
+ end
23
+
24
+ private
25
+
26
+ def self.base
27
+ ['ou=group', super].join(',')
28
+ end
29
+
30
+ def self.identifier
31
+ :cn
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+
38
+
@@ -0,0 +1,62 @@
1
+ require_relative 'base'
2
+ require_relative 'group'
3
+
4
+ module KU
5
+ module LDAP
6
+ module Entry
7
+ class User < Base
8
+
9
+ def self.authenticate directory, id, password
10
+ entry = Array(directory.authenticate(base, KU::LDAP::Filter.new.eq(identifier, id), password)).first
11
+ new entry if entry
12
+ end
13
+
14
+ def id
15
+ self[:uid]
16
+ end
17
+
18
+ def first_name
19
+ self[:givenname]
20
+ end
21
+
22
+ def last_name
23
+ self[:sn]
24
+ end
25
+
26
+ def full_name
27
+ self[:displayname]
28
+ end
29
+
30
+ def title
31
+ self[:title]
32
+ end
33
+
34
+ def primary_institution
35
+ self[:o]
36
+ end
37
+
38
+ def department
39
+ self[:departmentnumber]
40
+ end
41
+
42
+ def email
43
+ self[:mail]
44
+ end
45
+
46
+ def group_name
47
+ self[:employeetype]
48
+ end
49
+
50
+ private
51
+
52
+ def self.base
53
+ ['ou=people', super].join(',')
54
+ end
55
+
56
+ def self.identifier
57
+ :uid
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,17 @@
1
+ require 'forwardable'
2
+
3
+ module KU
4
+ module LDAP
5
+ class Filter
6
+ extend Forwardable
7
+ def_delegators :@helper, :begins, :contains, :ends, :eq
8
+
9
+ def initialize helper=Net::LDAP::Filter
10
+ @helper = helper
11
+ end
12
+ end
13
+ end
14
+ end
15
+
16
+
17
+
@@ -0,0 +1,5 @@
1
+ module KU
2
+ module LDAP
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,95 @@
1
+ require_relative '../../spec_helper'
2
+ require_relative '../../../lib/ku/ldap/directory'
3
+
4
+ describe KU::LDAP::Directory do
5
+
6
+ subject {KU::LDAP::Directory.new service}
7
+ let(:service) {MiniTest::Mock.new}
8
+
9
+ describe '#first' do
10
+
11
+ before do
12
+ service.expect :search, [:foo], [{base: 'base', filter: 'filter'}]
13
+ @result = subject.first 'base', 'filter'
14
+ end
15
+
16
+ it 'must delegate to service' do
17
+ service.verify
18
+ end
19
+
20
+ it 'must return first result' do
21
+ @result.must_equal :foo
22
+ end
23
+ end
24
+
25
+ describe '#search' do
26
+
27
+ before do
28
+ service.expect :search, [:foo], [{base: 'base', filter: 'filter'}]
29
+ @result = subject.search 'base', 'filter'
30
+ end
31
+
32
+ it 'must delegate to service' do
33
+ service.verify
34
+ end
35
+
36
+ it 'must return an array of results' do
37
+ @result.must_be_instance_of Array
38
+ @result.first.must_equal :foo
39
+ end
40
+ end
41
+
42
+ describe '#authenticate' do
43
+
44
+ describe 'valid' do
45
+
46
+ before do
47
+ service.expect :bind_as, [:foo], [{base: 'base', filter: 'filter', password: 'password'}]
48
+ @result = subject.authenticate 'base', 'filter', 'password'
49
+ end
50
+
51
+ it 'must return an array of results' do
52
+ @result.must_be_instance_of Array
53
+ @result.first.must_equal :foo
54
+ end
55
+ end
56
+
57
+ describe 'invalid' do
58
+
59
+ before do
60
+ service.expect :bind_as, nil, [{base: 'base', filter: 'filter', password: 'password'}]
61
+ @result = subject.authenticate 'base', 'filter', 'password'
62
+ end
63
+
64
+ it 'must return nil' do
65
+ @result.must_be_instance_of NilClass
66
+ end
67
+ end
68
+ end
69
+
70
+ describe 'service authentication' do
71
+
72
+ describe 'without credentials' do
73
+
74
+ it 'wont authenticate' do
75
+ subject
76
+ end
77
+ end
78
+
79
+ describe 'with credentials' do
80
+
81
+ before do
82
+ ENV['KU_LDAP_USERNAME'] = ENV['KU_LDAP_PASSWORD'] = 'foo'
83
+ end
84
+
85
+ after do
86
+ ENV['KU_LDAP_USERNAME'] = ENV['KU_LDAP_PASSWORD'] = nil
87
+ end
88
+
89
+ it 'must authenticate' do
90
+ service.expect :authenticate, true, [String, String]
91
+ subject
92
+ end
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,52 @@
1
+ require_relative '../../../spec_helper'
2
+ require_relative '../../../../lib/ku/ldap/entry/base'
3
+
4
+ describe KU::LDAP::Entry::Base do
5
+
6
+ subject {KU::LDAP::Entry::Base}
7
+ let(:directory) {MiniTest::Mock.new}
8
+ let(:filter) {MiniTest::Mock.new}
9
+
10
+ describe '::first' do
11
+
12
+ before do
13
+ directory.expect :first, {}, [KU::LDAP::Entry::Base::BASE, String]
14
+ filter.expect :eq, '', [Symbol, String]
15
+ @result = subject.first directory, 'abc123', filter
16
+ end
17
+
18
+ it 'must delegate to directory' do
19
+ directory.verify
20
+ end
21
+
22
+ it 'must delegate to filter' do
23
+ filter.verify
24
+ end
25
+
26
+ it 'must return a new instance' do
27
+ @result.must_be_instance_of subject
28
+ end
29
+ end
30
+
31
+ describe '::search' do
32
+
33
+ before do
34
+ directory.expect :search, [{},{}], [KU::LDAP::Entry::Base::BASE, String]
35
+ filter.expect :send, '', [:contains, Symbol, String]
36
+ @result = subject.search directory, :attr, 'value', :contains, filter
37
+ end
38
+
39
+ it 'must delegate to directory' do
40
+ directory.verify
41
+ end
42
+
43
+ it 'must delegate to filter' do
44
+ filter.verify
45
+ end
46
+
47
+ it 'must return an array of instances' do
48
+ @result.must_be_instance_of Array
49
+ @result.each {|r| r.must_be_instance_of subject}
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,90 @@
1
+ require_relative '../../../spec_helper'
2
+ require_relative '../../../../lib/ku/ldap/entry/group'
3
+
4
+ describe KU::LDAP::Entry::Group do
5
+
6
+ subject {KU::LDAP::Entry::Group}
7
+ let(:directory) {MiniTest::Mock.new}
8
+ let(:filter) {MiniTest::Mock.new}
9
+
10
+ describe '::first' do
11
+
12
+ before do
13
+ directory.expect :first, {}, ['ou=group,' + KU::LDAP::Entry::Base::BASE, String]
14
+ filter.expect :eq, '', [:cn, String]
15
+ @result = subject.first directory, 'abc123', filter
16
+ end
17
+
18
+ it 'must delegate to directory' do
19
+ directory.verify
20
+ end
21
+
22
+ it 'must delegate to filter' do
23
+ filter.verify
24
+ end
25
+
26
+ it 'must return a new instance' do
27
+ @result.must_be_instance_of subject
28
+ end
29
+ end
30
+
31
+ describe '::search' do
32
+
33
+ before do
34
+ directory.expect :search, [{},{}], ['ou=group,' + KU::LDAP::Entry::Base::BASE, String]
35
+ filter.expect :send, '', [:contains, :attr, String]
36
+ @result = subject.search directory, :attr, 'value', :contains, filter
37
+ end
38
+
39
+ it 'must delegate to directory' do
40
+ directory.verify
41
+ end
42
+
43
+ it 'must delegate to filter' do
44
+ filter.verify
45
+ end
46
+
47
+ it 'must return an array of instances' do
48
+ @result.must_be_instance_of Array
49
+ @result.each {|r| r.must_be_instance_of subject}
50
+ end
51
+ end
52
+
53
+ describe 'attributes' do
54
+
55
+ let(:attributes) do
56
+ attrs = Hash.new {|hash,key| hash[key] = []}
57
+ attrs[:cn] << 'id'
58
+ attrs[:description] << 'description'
59
+ attrs[:o] << 'primary_institution'
60
+ attrs[:memberuid] << 'abc123'
61
+ attrs
62
+ end
63
+
64
+ before do
65
+ @user = subject.send :new, attributes
66
+ end
67
+
68
+ %w(id description primary_institution).each do |attribute|
69
+ it "must return #{attribute}" do
70
+ @user.send(attribute.to_sym).must_equal attribute
71
+ end
72
+ end
73
+
74
+ it 'must return array of member ids' do
75
+ @user.members.must_be_instance_of Array
76
+ @user.members.first.must_equal 'abc123'
77
+ end
78
+
79
+ describe '#member?' do
80
+
81
+ it 'must confirm membership' do
82
+ assert @user.member? 'abc123'
83
+ end
84
+
85
+ it 'wont confirm non-membership' do
86
+ refute @user.member? 'def456'
87
+ end
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,79 @@
1
+ require_relative '../../../spec_helper'
2
+ require_relative '../../../../lib/ku/ldap/entry/user'
3
+
4
+ describe KU::LDAP::Entry::User do
5
+
6
+ subject {KU::LDAP::Entry::User}
7
+ let(:directory) {MiniTest::Mock.new}
8
+ let(:filter) {MiniTest::Mock.new}
9
+
10
+ describe '::first' do
11
+
12
+ before do
13
+ directory.expect :first, {}, ['ou=people,' + KU::LDAP::Entry::Base::BASE, String]
14
+ filter.expect :eq, '', [:uid, String]
15
+ @result = subject.first directory, 'abc123', filter
16
+ end
17
+
18
+ it 'must delegate to directory' do
19
+ directory.verify
20
+ end
21
+
22
+ it 'must delegate to filter' do
23
+ filter.verify
24
+ end
25
+
26
+ it 'must return a new instance' do
27
+ @result.must_be_instance_of subject
28
+ end
29
+ end
30
+
31
+ describe '::search' do
32
+
33
+ before do
34
+ directory.expect :search, [{},{}], ['ou=people,' + KU::LDAP::Entry::Base::BASE, String]
35
+ filter.expect :send, '', [:contains, :attr, String]
36
+ @result = subject.search directory, :attr, 'value', :contains, filter
37
+ end
38
+
39
+ it 'must delegate to directory' do
40
+ directory.verify
41
+ end
42
+
43
+ it 'must delegate to filter' do
44
+ filter.verify
45
+ end
46
+
47
+ it 'must return an array of instances' do
48
+ @result.must_be_instance_of Array
49
+ @result.each {|r| r.must_be_instance_of subject}
50
+ end
51
+ end
52
+
53
+ describe 'attributes' do
54
+
55
+ let(:attributes) do
56
+ attrs = Hash.new {|hash,key| hash[key] = []}
57
+ attrs[:uid] << 'id'
58
+ attrs[:givenname] << 'first_name'
59
+ attrs[:sn] << 'last_name'
60
+ attrs[:displayname] << 'full_name'
61
+ attrs[:title] << 'title'
62
+ attrs[:o] << 'primary_institution'
63
+ attrs[:departmentnumber] << 'department'
64
+ attrs[:mail] << 'email'
65
+ attrs[:employeetype] << 'group_name'
66
+ attrs
67
+ end
68
+
69
+ before do
70
+ @user = subject.send :new, attributes
71
+ end
72
+
73
+ %w(id first_name last_name full_name title primary_institution department email group_name).each do |attribute|
74
+ it "must return #{attribute}" do
75
+ @user.send(attribute.to_sym).must_equal attribute
76
+ end
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,107 @@
1
+ require_relative '../spec_helper'
2
+ require_relative '../../lib/ku/ldap'
3
+
4
+ describe KU::LDAP do
5
+
6
+ subject {
7
+ Module.new do
8
+ extend KU::LDAP
9
+
10
+ def self.service
11
+ Object.new
12
+ end
13
+ end
14
+ }
15
+
16
+ describe '#user' do
17
+
18
+ let(:user_class) {MiniTest::Mock.new}
19
+
20
+ before do
21
+ user_class.expect :first, Object.new, [KU::LDAP::Directory, String]
22
+ @result = subject.user 'abc123', user_class
23
+ end
24
+
25
+ it 'delegates to user class' do
26
+ user_class.verify
27
+ end
28
+
29
+ it 'must return instance of user class' do
30
+ @result.must_be_instance_of Object
31
+ end
32
+ end
33
+
34
+ describe '#authenticate' do
35
+
36
+ let(:user_class) {MiniTest::Mock.new}
37
+
38
+ before do
39
+ user_class.expect :authenticate, Object.new, [KU::LDAP::Directory, String, String]
40
+ @result = subject.authenticate_user 'abc123', 'password', user_class
41
+ end
42
+
43
+ it 'delegates to user class' do
44
+ user_class.verify
45
+ end
46
+
47
+ it 'must return instance of user class' do
48
+ @result.must_be_instance_of Object
49
+ end
50
+ end
51
+
52
+ describe '#users' do
53
+
54
+ let(:user_class) {MiniTest::Mock.new}
55
+
56
+ before do
57
+ user_class.expect :search, [Object.new], [KU::LDAP::Directory, Symbol, String, Symbol]
58
+ @result = subject.users :attribute, 'value', :contains, user_class
59
+ end
60
+
61
+ it 'delegates to user class' do
62
+ user_class.verify
63
+ end
64
+
65
+ it 'must return an array of instance of user class' do
66
+ @result.must_be_instance_of Array
67
+ @result.first.must_be_instance_of Object
68
+ end
69
+ end
70
+
71
+ describe '#group' do
72
+
73
+ let(:group_class) {MiniTest::Mock.new}
74
+
75
+ before do
76
+ group_class.expect :first, Object.new, [KU::LDAP::Directory, String]
77
+ @result = subject.group 'abc123', group_class
78
+ end
79
+
80
+ it 'delegates to group class' do
81
+ group_class.verify
82
+ end
83
+
84
+ it 'must return instance of group class' do
85
+ @result.must_be_instance_of Object
86
+ end
87
+ end
88
+
89
+ describe '#groups' do
90
+
91
+ let(:group_class) {MiniTest::Mock.new}
92
+
93
+ before do
94
+ group_class.expect :search, [Object.new], [KU::LDAP::Directory, Symbol, String, Symbol]
95
+ @result = subject.groups :attribute, 'value', :contains, group_class
96
+ end
97
+
98
+ it 'delegates to group class' do
99
+ group_class.verify
100
+ end
101
+
102
+ it 'must return an array of instance of group class' do
103
+ @result.must_be_instance_of Array
104
+ @result.first.must_be_instance_of Object
105
+ end
106
+ end
107
+ end
@@ -0,0 +1 @@
1
+ require 'minitest/autorun'
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ku-ldap
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - jamiehodge
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-11-19 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ prerelease: false
16
+ type: :runtime
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ none: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ! '>='
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ none: false
29
+ name: net-ldap
30
+ description: A client for the Copenhagen University LDAP service.
31
+ email:
32
+ - jamiehodge@me.com
33
+ executables: []
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - .gitignore
38
+ - Gemfile
39
+ - LICENSE
40
+ - README.md
41
+ - Rakefile
42
+ - ku-ldap.gemspec
43
+ - lib/ku/ldap.rb
44
+ - lib/ku/ldap/directory.rb
45
+ - lib/ku/ldap/entry.rb
46
+ - lib/ku/ldap/entry/base.rb
47
+ - lib/ku/ldap/entry/group.rb
48
+ - lib/ku/ldap/entry/user.rb
49
+ - lib/ku/ldap/filter.rb
50
+ - lib/ku/ldap/version.rb
51
+ - spec/ku/ldap/directory_spec.rb
52
+ - spec/ku/ldap/entry/base_spec.rb
53
+ - spec/ku/ldap/entry/group_spec.rb
54
+ - spec/ku/ldap/entry/user_spec.rb
55
+ - spec/ku/ldap_spec.rb
56
+ - spec/spec_helper.rb
57
+ homepage: ''
58
+ licenses: []
59
+ post_install_message:
60
+ rdoc_options: []
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ! '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ none: false
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ! '>='
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ none: false
75
+ requirements: []
76
+ rubyforge_project:
77
+ rubygems_version: 1.8.24
78
+ signing_key:
79
+ specification_version: 3
80
+ summary: A client for the Copenhagen University LDAP service.
81
+ test_files:
82
+ - spec/ku/ldap/directory_spec.rb
83
+ - spec/ku/ldap/entry/base_spec.rb
84
+ - spec/ku/ldap/entry/group_spec.rb
85
+ - spec/ku/ldap/entry/user_spec.rb
86
+ - spec/ku/ldap_spec.rb
87
+ - spec/spec_helper.rb