hydra-core 7.0.0 → 7.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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e00f40dbd2788db9f9604419b786044b7634d05
|
4
|
+
data.tar.gz: f2a980dcfd1dce0761ddc87d24f52f196511020a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e2936a83461ca3a9a53dfccb945a3993b4965780bfbbb035a7ee61b5729218b3b4c347ec8e9ee15242b3969daf19590aecf5366a6107dccd9202b8d63d7281d
|
7
|
+
data.tar.gz: 450565c96214fd6c7de40d78dd5d9313331871d3997c42802ddb84d839b295a40877274ade67ba3edc1109cb2b4e2e986c0374159987f31f8c8bd7a4a035805e
|
@@ -16,14 +16,14 @@ module Hydra::Controller::ControllerBehavior
|
|
16
16
|
include Hydra::AccessControlsEnforcement
|
17
17
|
|
18
18
|
# Catch permission errors
|
19
|
-
rescue_from
|
19
|
+
rescue_from CanCan::AccessDenied do |exception|
|
20
20
|
if (exception.action == :edit)
|
21
21
|
redirect_to({:action=>'show'}, :alert => exception.message)
|
22
22
|
elsif current_user and current_user.persisted?
|
23
|
-
redirect_to
|
23
|
+
redirect_to root_path, :alert => exception.message
|
24
24
|
else
|
25
25
|
session["user_return_to"] = request.url
|
26
|
-
redirect_to
|
26
|
+
redirect_to new_user_session_path, :alert => exception.message
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
data/lib/hydra-head/version.rb
CHANGED
@@ -4,6 +4,8 @@ describe DownloadsController do
|
|
4
4
|
before do
|
5
5
|
Rails.application.routes.draw do
|
6
6
|
resources :downloads
|
7
|
+
devise_for :users
|
8
|
+
root to: 'catalog#index'
|
7
9
|
end
|
8
10
|
end
|
9
11
|
|
@@ -32,12 +34,35 @@ describe DownloadsController do
|
|
32
34
|
@obj.destroy
|
33
35
|
Object.send(:remove_const, :ContentHolder)
|
34
36
|
end
|
35
|
-
|
37
|
+
context "when not logged in" do
|
38
|
+
context "when a specific datastream is requested" do
|
39
|
+
it "should redirect to the root path and display an error" do
|
40
|
+
get "show", id: @obj.pid, datastream_id: "descMetadata"
|
41
|
+
expect(response).to redirect_to new_user_session_path
|
42
|
+
expect(flash[:alert]).to eq "You are not authorized to access this page."
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
context "when logged in, but without read access" do
|
47
|
+
let(:user) { User.new.tap {|u| u.email = 'email2@example.com'; u.password = 'password'; u.save} }
|
48
|
+
before do
|
49
|
+
sign_in user
|
50
|
+
end
|
51
|
+
context "when a specific datastream is requested" do
|
52
|
+
it "should redirect to the root path and display an error" do
|
53
|
+
get "show", id: @obj.pid, datastream_id: "descMetadata"
|
54
|
+
expect(response).to redirect_to root_path
|
55
|
+
expect(flash[:alert]).to eq "You are not authorized to access this page."
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
context "when logged in as reader" do
|
36
61
|
before do
|
37
62
|
sign_in @user
|
38
63
|
User.any_instance.stub(:groups).and_return([])
|
39
64
|
end
|
40
|
-
describe "show" do
|
65
|
+
describe "#show" do
|
41
66
|
it "should default to returning default download configured by object" do
|
42
67
|
ContentHolder.stub(:default_content_ds).and_return('buzz')
|
43
68
|
get "show", :id => @obj.pid
|
@@ -167,7 +192,10 @@ describe DownloadsController do
|
|
167
192
|
it "should authorize according to can_download?" do
|
168
193
|
controller.current_ability.can?(:download, @obj.datastreams['buzz']).should be_true
|
169
194
|
controller.stub(:can_download?).and_return(false)
|
170
|
-
|
195
|
+
Deprecation.silence(Hydra::Controller::DownloadBehavior) do
|
196
|
+
get :show, id: @obj, datastream_id: 'buzz'
|
197
|
+
end
|
198
|
+
expect(response).to redirect_to root_url
|
171
199
|
end
|
172
200
|
end
|
173
201
|
context "current_ability.can? returns false / can_download? returns true" do
|
@@ -178,7 +206,9 @@ describe DownloadsController do
|
|
178
206
|
it "should authorize according to can_download?" do
|
179
207
|
controller.current_ability.can?(:download, @obj.datastreams['buzz']).should be_false
|
180
208
|
controller.stub(:can_download?).and_return(true)
|
181
|
-
|
209
|
+
Deprecation.silence(Hydra::Controller::DownloadBehavior) do
|
210
|
+
get :show, id: @obj, datastream_id: 'buzz'
|
211
|
+
end
|
182
212
|
response.should be_successful
|
183
213
|
end
|
184
214
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hydra-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.0.
|
4
|
+
version: 7.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Zumwalt, Bess Sadler, Julie Meloni, Naomi Dushay, Jessie Keck, John Scofield,
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-04-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -51,14 +51,14 @@ dependencies:
|
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 7.0.
|
54
|
+
version: 7.0.1
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
57
|
version_requirements: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 7.0.
|
61
|
+
version: 7.0.1
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: jettywrapper
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|