acs-ldap 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/acs/ldap/pusher.rb +7 -5
- data/lib/acs/ldap/version.rb +1 -1
- data/spec/acs/ldap/pusher_spec.rb +17 -0
- 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: 708c65f42bfc35fbb765e5432364acc6707e6690
|
4
|
+
data.tar.gz: e486ea99c68c0fcbceff93e7d17d33da14ec8dce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28d47c208aeaea4ffbd9f791d764998e33e3a3249617e3b57722c8caed5272155c08c05b9445124d38016ac96802f41c379df0a316047051ad70c470cd1e11b9
|
7
|
+
data.tar.gz: 07003ee47926a03ca634f29418ec19905945c5542b3c535672ef45dc7ecfe1241b82bde8b948085af36420e739d28ed20c66ffe0cbbb58c60be7ee3d4cd48ed2
|
data/lib/acs/ldap/pusher.rb
CHANGED
@@ -19,6 +19,11 @@ class Acs::Ldap::Pusher
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
+
def index
|
23
|
+
filter = Net::LDAP::Filter.pres('uid')
|
24
|
+
@connector.search({base: base, filter: filter})
|
25
|
+
end
|
26
|
+
|
22
27
|
def create(model, options = {})
|
23
28
|
attributes = @mapper.attributes(model).except!(:uid)
|
24
29
|
attributes.merge!(objectClass: @mapper.object_class)
|
@@ -72,11 +77,8 @@ class Acs::Ldap::Pusher
|
|
72
77
|
end
|
73
78
|
|
74
79
|
def count
|
75
|
-
|
76
|
-
@connector.search({base: base}).data.
|
77
|
-
count += 1 if entry[:uid].present?
|
78
|
-
end
|
79
|
-
count
|
80
|
+
filter = Net::LDAP::Filter.pres('uid')
|
81
|
+
@connector.search({base: base, filter: filter}).data.count
|
80
82
|
end
|
81
83
|
|
82
84
|
protected
|
data/lib/acs/ldap/version.rb
CHANGED
@@ -45,6 +45,16 @@ describe Acs::Ldap::Pusher, order: :defined do
|
|
45
45
|
expect(@pusher.find_by('uid', 2).data[0][:givenName]).to eq ["Vador Dark"]
|
46
46
|
end
|
47
47
|
|
48
|
+
it "should be possible to count Users" do
|
49
|
+
user = User.new({id: 3, sn: "doe", cn: "john", givenName: "John Doe", userPassword: "{SSHA}+MBMtUqzkOeH8hI1KVnl+djdqzw0YmU5M2Y5MmQyOTgxMDU1", mail: "jdoe@adharacs.lan"})
|
50
|
+
user2 = User.new({id: 4, sn: "skywalker", cn: "luc", givenName: "Luc Skywalker", userPassword: "{SSHA}+MBMtUqzkOeH8hI1KVnl+djdqzw0YmU5M2Y5MmQyOTgxMDU1", mail: "lskywalker@adharacs.lan"})
|
51
|
+
expect(@pusher.create(user).success?).to eq true
|
52
|
+
expect(@pusher.create(user2).success?).to eq true
|
53
|
+
expect(@pusher.count).to eq 3
|
54
|
+
expect(@pusher.destroy(user).success?).to eq true
|
55
|
+
expect(@pusher.destroy(user2).success?).to eq true
|
56
|
+
end
|
57
|
+
|
48
58
|
it "should be possible to update only an attribute for a User" do
|
49
59
|
@user.givenName = "D V"
|
50
60
|
@user.mail = "dv@adharacs.lan"
|
@@ -53,6 +63,13 @@ describe Acs::Ldap::Pusher, order: :defined do
|
|
53
63
|
expect(@pusher.find_by('uid', 2).data[0][:mail]).to eq ["dvador@adharacs.lan"]
|
54
64
|
end
|
55
65
|
|
66
|
+
it "should be possible to list all Users" do
|
67
|
+
count = @pusher.count
|
68
|
+
result = @pusher.index
|
69
|
+
expect(result.success?).to eq true
|
70
|
+
expect(result.data.count).to eq count
|
71
|
+
end
|
72
|
+
|
56
73
|
it "should be possible to remove a User" do
|
57
74
|
expect(@pusher.destroy(@user).success?).to eq true
|
58
75
|
expect(@pusher.count).to eq 0
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acs-ldap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Terranova David
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|