ddr-models 3.0.1 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac3fde76afdd04c188208ae9f82e637fbf7a6c05
|
4
|
+
data.tar.gz: 7bd9cf7895be31f83557505d02256d0f10ab5b7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a498acd13aa0be7b1f7f99db275d1278dda26140960c450fbc27e6c93574f24cb42ce14edcd202b8c78024f5d2ed97a613fe4e25832ad8f2d29eb00794d37930
|
7
|
+
data.tar.gz: 272e6699ccb404fa3c8976ad7ce444c159bc16ff9bbd55aeefd9b27e819f3f187fd1a187b910d16d5e79bc6e5438fe384e1c9c2b9fdd50479315d8cb307b6dfc
|
@@ -11,12 +11,12 @@ module Ddr::Auth
|
|
11
11
|
|
12
12
|
# @return [Array<String>]
|
13
13
|
def affiliation
|
14
|
-
split_env("affiliation").map { |a| a.sub(/@duke\.edu\z/, "") }
|
14
|
+
anonymous? ? super : split_env("affiliation").map { |a| a.sub(/@duke\.edu\z/, "") }
|
15
15
|
end
|
16
16
|
|
17
17
|
# @return [Array<String>]
|
18
18
|
def ismemberof
|
19
|
-
split_env("ismemberof")
|
19
|
+
anonymous? ? super : split_env("ismemberof")
|
20
20
|
end
|
21
21
|
|
22
22
|
private
|
data/lib/ddr/models/version.rb
CHANGED
@@ -3,7 +3,6 @@ module Ddr::Auth
|
|
3
3
|
|
4
4
|
subject { described_class.new(user, env) }
|
5
5
|
|
6
|
-
let(:user) { FactoryGirl.build(:user) }
|
7
6
|
let(:mock_ip_middleware) { double(calculate_ip: "8.8.8.8") }
|
8
7
|
|
9
8
|
let(:env) do
|
@@ -13,18 +12,38 @@ module Ddr::Auth
|
|
13
12
|
}
|
14
13
|
end
|
15
14
|
|
16
|
-
|
15
|
+
shared_examples "a web auth context" do
|
16
|
+
it_behaves_like "an auth context"
|
17
|
+
its(:ip_address) { should eq("8.8.8.8") }
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "authenticated" do
|
21
|
+
let(:user) { FactoryGirl.build(:user) }
|
17
22
|
|
18
|
-
|
19
|
-
|
20
|
-
|
23
|
+
it_behaves_like "a web auth context"
|
24
|
+
its(:affiliation) { should contain_exactly("staff", "student") }
|
25
|
+
its(:ismemberof) { should contain_exactly("group1", "group2", "group3") }
|
26
|
+
|
27
|
+
describe "when env vars are not present" do
|
28
|
+
let(:env) { {} }
|
29
|
+
its(:affiliation) { should be_empty }
|
30
|
+
its(:ismemberof) { should be_empty }
|
31
|
+
its(:ip_address) { should be_nil }
|
32
|
+
end
|
33
|
+
end
|
21
34
|
|
22
|
-
describe "
|
23
|
-
let(:
|
35
|
+
describe "anonymous" do
|
36
|
+
let(:user) { nil }
|
37
|
+
|
38
|
+
it_behaves_like "a web auth context"
|
24
39
|
its(:affiliation) { should be_empty }
|
25
40
|
its(:ismemberof) { should be_empty }
|
26
|
-
|
41
|
+
|
42
|
+
describe "when env vars are not present" do
|
43
|
+
let(:env) { {} }
|
44
|
+
its(:ip_address) { should be_nil }
|
45
|
+
end
|
27
46
|
end
|
28
|
-
|
47
|
+
|
29
48
|
end
|
30
49
|
end
|
@@ -40,7 +40,9 @@ module Ddr::Auth
|
|
40
40
|
|
41
41
|
describe "#agents" do
|
42
42
|
before { allow(subject).to receive(:groups) { [ Groups::PUBLIC, Groups::REGISTERED, Group.new("foo") ] } }
|
43
|
-
its(:agents) {
|
43
|
+
its(:agents) {
|
44
|
+
are_expected.to match_array([subject.agent, Groups::PUBLIC.agent, Groups::REGISTERED.agent, "foo"].compact)
|
45
|
+
}
|
44
46
|
end
|
45
47
|
|
46
48
|
describe "#member_of?" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ddr-models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jim Coble
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-06-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|