hydra-access-controls 7.2.1 → 7.2.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: d443ec507006b3d9f0c15ffa68e0a5e13736386a
|
4
|
+
data.tar.gz: f634a0c9d408027ca268490158e02ef27cb4dc28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92aea9fff4e578c80ec13c3faf8ebca5dca5c3f09531f79d6de053394242a6942e4803c1f67810b65a962e0d20be1069038473c8c30a158d694f9bc15d31d575
|
7
|
+
data.tar.gz: 1893daf644784b0c7141f2a52095f67c20704b27d65dcd7a3c59dc3c486fe517b5ee7fbd9fbb83f124428e0cda0922e34ae30d2c73c4f965d5418626d3cafccf
|
@@ -44,6 +44,7 @@ module Hydra
|
|
44
44
|
self.visibility_during_embargo = visibility_during unless visibility_during.nil?
|
45
45
|
self.visibility_after_embargo = visibility_after unless visibility_after.nil?
|
46
46
|
embargo_visibility!
|
47
|
+
visibility_will_change!
|
47
48
|
end
|
48
49
|
|
49
50
|
def deactivate_embargo!
|
@@ -54,6 +55,7 @@ module Hydra
|
|
54
55
|
self.visibility_during_embargo = nil
|
55
56
|
self.visibility_after_embargo = nil
|
56
57
|
self.embargo_history += [embargo_record]
|
58
|
+
visibility_will_change!
|
57
59
|
end
|
58
60
|
|
59
61
|
def validate_embargo
|
@@ -115,7 +117,8 @@ module Hydra
|
|
115
117
|
self.lease_expiration_date = release_date
|
116
118
|
self.visibility_during_lease = visibility_during unless visibility_during.nil?
|
117
119
|
self.visibility_after_lease = visibility_after unless visibility_after.nil?
|
118
|
-
|
120
|
+
lease_visibility!
|
121
|
+
visibility_will_change!
|
119
122
|
end
|
120
123
|
|
121
124
|
def deactivate_lease!
|
@@ -126,6 +129,7 @@ module Hydra
|
|
126
129
|
self.visibility_during_lease = nil
|
127
130
|
self.visibility_after_lease = nil
|
128
131
|
self.lease_history += [lease_record]
|
132
|
+
visibility_will_change!
|
129
133
|
end
|
130
134
|
|
131
135
|
# Set the current visibility to match what is described in the lease.
|
@@ -35,15 +35,22 @@ describe Hydra::AccessControls::Embargoable do
|
|
35
35
|
expect(subject).to receive(:deactivate_embargo!)
|
36
36
|
subject.visibility = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
|
37
37
|
end
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
38
|
+
|
39
|
+
context "when changing from lease" do
|
40
|
+
it "wipes out associated lease metadata and marks visibility as changed" do
|
41
|
+
subject.apply_lease(future_date.to_s, Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED, Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE)
|
42
|
+
expect(subject).to receive(:deactivate_lease!)
|
43
|
+
subject.visibility = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
|
44
|
+
expect(subject).to be_visibility_changed
|
45
|
+
end
|
42
46
|
end
|
43
47
|
end
|
48
|
+
|
44
49
|
context 'apply_embargo' do
|
45
50
|
it "applies appropriate embargo_visibility settings" do
|
46
|
-
|
51
|
+
expect {
|
52
|
+
subject.apply_embargo(future_date.to_s, Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE, Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC)
|
53
|
+
}.to change { subject.visibility_changed? }.from(false).to(true)
|
47
54
|
expect(subject).to be_under_embargo
|
48
55
|
expect(subject.visibility).to eq Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
|
49
56
|
expect(subject.embargo_release_date).to eq future_date.to_time.utc
|
@@ -84,7 +91,8 @@ describe Hydra::AccessControls::Embargoable do
|
|
84
91
|
it "should remove the associated embargo information and record it in the object's embargo history" do
|
85
92
|
expect {
|
86
93
|
subject.deactivate_embargo!
|
87
|
-
}.to change { subject.under_embargo? }.from(true).to(false)
|
94
|
+
}.to change { subject.under_embargo? }.from(true).to(false).and change {
|
95
|
+
subject.visibility_changed? }.from(false).to(true)
|
88
96
|
expect(subject.embargo_release_date).to be_nil
|
89
97
|
expect(subject.visibility_during_embargo).to be_nil
|
90
98
|
expect(subject.visibility_after_embargo).to be_nil
|
@@ -104,18 +112,39 @@ describe Hydra::AccessControls::Embargoable do
|
|
104
112
|
end
|
105
113
|
|
106
114
|
context 'apply_lease' do
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
115
|
+
context "when the initial value is restricted" do
|
116
|
+
it "applies appropriate embargo_visibility settings" do
|
117
|
+
subject.apply_lease(future_date.to_s, Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC, Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE)
|
118
|
+
expect(subject).to be_active_lease
|
119
|
+
expect(subject).to be_visibility_changed
|
120
|
+
expect(subject.visibility).to eq Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
|
121
|
+
expect(subject.lease_expiration_date).to eq future_date.to_time.utc
|
122
|
+
expect(subject.visibility_after_lease).to eq Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
|
123
|
+
end
|
124
|
+
it "relies on default before/after visibility if none provided" do
|
125
|
+
subject.apply_lease(future_date.to_s)
|
126
|
+
expect(subject.visibility_during_lease).to eq Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED
|
127
|
+
expect(subject.lease_expiration_date).to eq future_date.to_time.utc
|
128
|
+
expect(subject.visibility_after_lease).to eq Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
|
129
|
+
end
|
113
130
|
end
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
131
|
+
|
132
|
+
context "when the initial value is public" do
|
133
|
+
before do
|
134
|
+
subject.visibility = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
|
135
|
+
# reset the changed log
|
136
|
+
subject.send(:instance_variable_set, :@visibility_will_change, false)
|
137
|
+
end
|
138
|
+
|
139
|
+
it "applies appropriate embargo_visibility settings" do
|
140
|
+
expect {
|
141
|
+
subject.apply_lease(future_date.to_s, Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC, Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE)
|
142
|
+
}.to change { subject.visibility_changed? }.from(false).to(true)
|
143
|
+
expect(subject).to be_active_lease
|
144
|
+
expect(subject.visibility).to eq Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
|
145
|
+
expect(subject.lease_expiration_date).to eq future_date.to_time.utc
|
146
|
+
expect(subject.visibility_after_lease).to eq Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
|
147
|
+
end
|
119
148
|
end
|
120
149
|
end
|
121
150
|
|
@@ -130,7 +159,9 @@ describe Hydra::AccessControls::Embargoable do
|
|
130
159
|
let(:expiration_date) { past_date.to_s }
|
131
160
|
|
132
161
|
it "should remove the associated lease information and record it in the object's lease history" do
|
133
|
-
|
162
|
+
expect {
|
163
|
+
subject.deactivate_lease!
|
164
|
+
}.to change { subject.visibility_changed? }.from(false).to(true)
|
134
165
|
expect(subject.lease_expiration_date).to be_nil
|
135
166
|
expect(subject.visibility_during_lease).to be_nil
|
136
167
|
expect(subject.visibility_after_lease).to be_nil
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hydra-access-controls
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.2.
|
4
|
+
version: 7.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Beer
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-09-
|
13
|
+
date: 2014-09-26 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -236,7 +236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
236
236
|
version: '0'
|
237
237
|
requirements: []
|
238
238
|
rubyforge_project:
|
239
|
-
rubygems_version: 2.
|
239
|
+
rubygems_version: 2.2.2
|
240
240
|
signing_key:
|
241
241
|
specification_version: 4
|
242
242
|
summary: Access controls for project hydra
|