hydra-core 9.3.0 → 9.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/concerns/hydra/controller/controller_behavior.rb +0 -3
- data/app/controllers/concerns/hydra/controller/download_behavior.rb +1 -1
- data/app/controllers/concerns/hydra/controller/ip_based_ability.rb +9 -0
- data/app/controllers/concerns/hydra/controller/search_builder.rb +1 -1
- data/lib/hydra-head/version.rb +1 -1
- data/spec/controllers/ip_based_ability_spec.rb +22 -0
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3aafc89dec95ca89ab2ff03a21972eacad393681
|
4
|
+
data.tar.gz: ac8fe4bd904f9d1e481321dce1407c483628d2c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a7fb894e9c174171668650660144c5c3ad572ad406fbd883902e3be58193e14d74a84b69b776d5e14c4c173919e65a0a23a86372c22eb02cbdbf67f278317c4
|
7
|
+
data.tar.gz: be273f18331a7bf62ec8a79aa79fef0226cd0f57fc5b79ae8a8b0b2a0bc08c47ad5dddd0a92c691031702823780f322053ff78911f4b365a74698f6c86426b4b
|
@@ -1,8 +1,5 @@
|
|
1
1
|
# Include this module into any of your Controller classes to add Hydra functionality
|
2
2
|
#
|
3
|
-
# The primary function of this module is to mix in a number of other Hydra Modules, including
|
4
|
-
# Hydra::AccessControlsEnforcement
|
5
|
-
#
|
6
3
|
# @example
|
7
4
|
# class CustomHydraController < ApplicationController
|
8
5
|
# include Hydra::Controller::ControllerBehavior
|
@@ -135,7 +135,7 @@ module Hydra
|
|
135
135
|
def prepare_file_headers
|
136
136
|
send_file_headers! content_options
|
137
137
|
response.headers['Content-Type'] = file.mime_type
|
138
|
-
response.headers['Content-Length'] ||= file.size
|
138
|
+
response.headers['Content-Length'] ||= file.size.to_s
|
139
139
|
# Prevent Rack::ETag from calculating a digest over body
|
140
140
|
response.headers['Last-Modified'] = asset.modified_date.utc.strftime("%a, %d %b %Y %T GMT")
|
141
141
|
self.content_type = file.mime_type
|
@@ -0,0 +1,9 @@
|
|
1
|
+
module Hydra::Controller
|
2
|
+
module IpBasedAbility
|
3
|
+
# Overriding the default method provided by cancan
|
4
|
+
# This passes the remote_ip to the Ability instance
|
5
|
+
def current_ability
|
6
|
+
@current_ability ||= ::Ability.new(current_user, remote_ip: request.remote_ip)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Hydra::Controller::SearchBuilder
|
2
2
|
extend ActiveSupport::Concern
|
3
3
|
|
4
|
-
# Override blacklight to produce a search_builder that has the current
|
4
|
+
# Override blacklight to produce a search_builder that has the current ability in context
|
5
5
|
def search_builder processor_chain = search_params_logic
|
6
6
|
super.tap { |builder| builder.current_ability = current_ability }
|
7
7
|
end
|
data/lib/hydra-head/version.rb
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'IpBasedAbilitySpec' do
|
4
|
+
controller do
|
5
|
+
include Hydra::Controller::IpBasedAbility
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '#ability' do
|
9
|
+
let(:user) { double }
|
10
|
+
let(:ip) { '123.456.789.111' }
|
11
|
+
|
12
|
+
before do
|
13
|
+
allow(controller).to receive(:current_user).and_return(user)
|
14
|
+
allow_any_instance_of(ActionDispatch::Request).to receive(:remote_ip) { ip }
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'passes ip to ability' do
|
18
|
+
expect(Ability).to receive(:new).with(user, remote_ip: ip)
|
19
|
+
controller.current_ability
|
20
|
+
end
|
21
|
+
end
|
22
|
+
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: 9.
|
4
|
+
version: 9.4.0
|
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: 2015-
|
12
|
+
date: 2015-11-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -31,14 +31,14 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - '='
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 9.
|
34
|
+
version: 9.4.0
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - '='
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: 9.
|
41
|
+
version: 9.4.0
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: jettywrapper
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -138,6 +138,7 @@ files:
|
|
138
138
|
- app/controllers/concerns/hydra/controller.rb
|
139
139
|
- app/controllers/concerns/hydra/controller/controller_behavior.rb
|
140
140
|
- app/controllers/concerns/hydra/controller/download_behavior.rb
|
141
|
+
- app/controllers/concerns/hydra/controller/ip_based_ability.rb
|
141
142
|
- app/controllers/concerns/hydra/controller/search_builder.rb
|
142
143
|
- app/helpers/blacklight_helper.rb
|
143
144
|
- app/helpers/hydra/blacklight_helper_behavior.rb
|
@@ -171,6 +172,7 @@ files:
|
|
171
172
|
- spec/.gitignore
|
172
173
|
- spec/controllers/catalog_controller_spec.rb
|
173
174
|
- spec/controllers/downloads_controller_spec.rb
|
175
|
+
- spec/controllers/ip_based_ability_spec.rb
|
174
176
|
- spec/factories.rb
|
175
177
|
- spec/helpers/blacklight_helper_spec.rb
|
176
178
|
- spec/lib/model_methods_spec.rb
|
@@ -221,6 +223,7 @@ test_files:
|
|
221
223
|
- spec/.gitignore
|
222
224
|
- spec/controllers/catalog_controller_spec.rb
|
223
225
|
- spec/controllers/downloads_controller_spec.rb
|
226
|
+
- spec/controllers/ip_based_ability_spec.rb
|
224
227
|
- spec/factories.rb
|
225
228
|
- spec/helpers/blacklight_helper_spec.rb
|
226
229
|
- spec/lib/model_methods_spec.rb
|