hydra-collections 5.0.0 → 5.0.1

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: ef2d245ae222f9d4aa4164e6e6293facd7ae8af7
4
- data.tar.gz: 2e785a983145507e7ca33cf38b0deabd4bfd0f68
3
+ metadata.gz: 66c141437035384dcd06f340506ab837348c902a
4
+ data.tar.gz: a817c59334b68041937292aabe05532713bd08a9
5
5
  SHA512:
6
- metadata.gz: 9975569dca4f4f8b6b7c5b426cb24045e0d8c07669af92982378f629cc02b8f2c56efeceb8101c7dcaf2a1dc8fd39f5aec8a059332ce5ad6c7bf1214ab4e68ba
7
- data.tar.gz: 7c3d2f47293e9899e300fae0e5bbe82492518e7825a2565ba05a8c7c04ab43ec6e7d04ea8921ad6201214d88c8751cb05c371c5a883e4f1b3cca1656ca4b3d85
6
+ metadata.gz: 4b4b34237bd666aa7f5ff1b7223f158111085c4a9c52260eea3998b5a01aff1e3969474f41b473633b2405c663b1a9be08f2abcd31905d39fe8c6aab0dfee7e7
7
+ data.tar.gz: 3390a8a96bb94996a2101111a12a9060a554985c3da39bc4469429f055d3eb7627843d0b61c4c03e102bf893eb57737091eba1423d432fdf3e8c70245c0fe929
data/.rspec CHANGED
@@ -1,2 +1 @@
1
1
  --colour
2
- --backtrace
data/Changelog.md CHANGED
@@ -1,3 +1,15 @@
1
+ # 5.0.1
2
+
3
+ * Fixed bug where access controls were not enforced by default
4
+
5
+ # 5.0.0
6
+
7
+ * Support for Blacklight 5.10 (HydraHead 9.1)
8
+
9
+ # 4.0.0
10
+
11
+ * Works with Fedora 4 (ActiveFedora/HydraHead 9)
12
+
1
13
  # 2.0.4
2
14
 
3
15
  * Updating dependencies
@@ -131,7 +131,7 @@ module Hydra
131
131
 
132
132
  # Defines which search_params_logic should be used when searching for Collection members
133
133
  def collection_member_search_logic
134
- search_params_logic + [:include_collection_ids]
134
+ search_params_logic + [:include_collection_ids, :add_access_controls_to_solr_params]
135
135
  end
136
136
 
137
137
  def collection_params
@@ -1,5 +1,5 @@
1
1
  module Hydra
2
2
  module Collections
3
- VERSION = "5.0.0"
3
+ VERSION = "5.0.1"
4
4
  end
5
5
  end
@@ -12,6 +12,7 @@ describe CollectionsController, :type => :controller do
12
12
 
13
13
  class GenericFile < ActiveFedora::Base
14
14
  include Hydra::Collections::Collectible
15
+ include Hydra::AccessControls::Permissions
15
16
 
16
17
  property :title, predicate: ::RDF::DC.title, multiple: false
17
18
 
@@ -215,73 +216,77 @@ describe CollectionsController, :type => :controller do
215
216
  end
216
217
  end
217
218
 
218
- describe "with a number of assets #show" do
219
+ describe "#show" do
219
220
  before do
220
- @asset1 = GenericFile.create!(title: "First of the Assets")
221
- @asset2 = GenericFile.create!(title: "Second of the Assets")
222
- @asset3 = GenericFile.create!(title: "Third of the Assets")
223
- @collection = Collection.new(id:"abc123")
224
- @collection.title = "My collection"
225
- @collection.apply_depositor_metadata(user.user_key)
226
- @collection.members = [@asset1, @asset2, @asset3]
227
- @collection.save!
228
221
  expect(controller).to receive(:authorize!).and_return(true)
229
- allow(controller).to receive(:apply_gated_search)
230
222
  end
231
223
 
232
- describe "additional collections" do
233
- before do
234
- @asset4 = GenericFile.create!(title: "#{@asset1.id}")
235
- @collection2 = Collection.new(id: "abc1234")
236
- @collection2.title = "Other collection"
237
- @collection2.apply_depositor_metadata(user.user_key)
238
- @collection2.members = [@asset4]
239
- @collection2.save
224
+ context "when there are no assets in the collection" do
225
+ let(:collection) { Collection.create(title: "Empty collection") }
226
+ it "shows no assets" do
227
+ get :show, id: collection
228
+ expect(response).to be_successful
229
+ expect(assigns[:collection].title).to eq("Empty collection")
230
+ expect(assigns[:member_docs]).to be_empty
240
231
  end
232
+ end
241
233
 
242
- it "should show only the collections assets" do
243
- get :show, id: @collection
244
- expect(assigns[:collection].title).to eq @collection.title
245
- expect(assigns[:member_docs].map(&:id)).to match_array [@asset1.id, @asset2.id, @asset3.id]
234
+ context "with a number of assets" do
235
+ let(:asset1) { GenericFile.create!(title: "First of the Assets", read_users: [user.user_key]) }
236
+ let(:asset2) { GenericFile.create!(title: "Second of the Assets", read_users: [user.user_key]) }
237
+ let(:asset3) { GenericFile.create!(title: "Third of the Assets", read_users: [user.user_key]) }
238
+ let!(:collection) do
239
+ Collection.create!(id: "abc123", title: "My collection",
240
+ members: [asset1, asset2, asset3]) do |col|
241
+ col.apply_depositor_metadata(user.user_key)
242
+ end
246
243
  end
247
244
 
248
- it "should show only the other collections assets" do
249
- get :show, id: @collection2
250
- expect(assigns[:collection].title).to eq @collection2.title
251
- expect(assigns[:member_docs].map(&:id)).to match_array [@asset4.id]
245
+ # NOTE: This test depends on title_tesim being in the qf in solrconfig.xml
246
+ it "queries the collections" do
247
+ get :show, id: collection, cq:"\"#{asset1.title}\""
248
+ expect(assigns[:collection].title).to eq collection.title
249
+ expect(assigns[:member_docs].map(&:id)).to match_array [asset1.id]
252
250
  end
253
- end
254
251
 
255
- it "when the collection is empty it should show no assets" do
256
- get :show, id: Collection.create(title: "Empty collection")
257
- expect(assigns[:collection].title).to eq("Empty collection")
258
- expect(assigns[:member_docs]).to be_empty
259
- end
252
+ it "returns the specified number of rows" do
253
+ get :show, id: collection, rows: "2"
254
+ expect(assigns[:collection].title).to eq collection.title
255
+ expect(assigns[:member_docs].size).to eq 2
256
+ end
260
257
 
261
- # NOTE: This test depends on title_tesim being in the qf in solrconfig.xml
262
- it "should query the collections" do
263
- get :show, id: @collection.id, cq:"\"#{@asset1.title}\""
264
- expect(assigns[:collection].title).to eq @collection.title
265
- expect(assigns[:member_docs].map(&:id)).to match_array [@asset1.id]
266
- end
258
+ describe "additional collections" do
259
+ let(:asset4) { GenericFile.create!(title: "#{asset1.id}", read_users: [user.user_key]) }
260
+ let!(:collection2) do
261
+ Collection.create!(id: "abc1234", title: "Other collection", members: [asset4]) do |col|
262
+ col.apply_depositor_metadata(user.user_key)
263
+ end
264
+ end
265
+ it "shows only the collections assets" do
266
+ get :show, id: collection
267
+ expect(assigns[:collection].title).to eq collection.title
268
+ expect(assigns[:member_docs].map(&:id)).to match_array [asset1.id, asset2.id, asset3.id]
269
+ end
267
270
 
268
- context "When there are search matches that are not in the collection" do
269
- before do
270
- GenericFile.create!(title: "#{@asset1.id} #{@asset1.title}")
271
- GenericFile.create!(title: @asset1.title.to_s)
272
- end
273
- # NOTE: This test depends on title_tesim being in the qf in solrconfig.xml
274
- it "should query the collections and show only the collection assets" do
275
- get :show, id: @collection, cq: "\"#{@asset1.title}\""
276
- expect(assigns[:collection].title).to eq @collection.title
277
- expect(assigns[:member_docs].map(&:id)).to match_array [@asset1.id]
271
+ it "shows only the other collections assets" do
272
+ get :show, id: collection2
273
+ expect(assigns[:collection].title).to eq collection2.title
274
+ expect(assigns[:member_docs].map(&:id)).to match_array [asset4.id]
275
+ end
278
276
  end
279
- end
280
277
 
281
- it "should query the collections with rows" do
282
- get :show, id: @collection, rows:"2"
283
- expect(assigns[:collection].title).to eq @collection.title
284
- expect(assigns[:member_docs].size).to eq 2
278
+ context "When there are search matches that are not in the collection" do
279
+ before do
280
+ GenericFile.create!(title: "#{asset1.id} #{asset1.title}")
281
+ GenericFile.create!(title: asset1.title.to_s)
282
+ end
283
+ # NOTE: This test depends on title_tesim being in the qf in solrconfig.xml
284
+ it "only shows the collection assets" do
285
+ get :show, id: collection, cq: "\"#{asset1.title}\""
286
+ expect(assigns[:collection].title).to eq collection.title
287
+ expect(assigns[:member_docs].map(&:id)).to match_array [asset1.id]
288
+ end
289
+ end
285
290
  end
286
291
  end
287
292
  end
@@ -10,6 +10,7 @@ describe OtherCollectionsController, :type => :controller do
10
10
 
11
11
  class Member < ActiveFedora::Base
12
12
  include Hydra::Collections::Collectible
13
+ include Hydra::AccessControls::Permissions
13
14
  attr_accessor :title
14
15
  end
15
16
  end
@@ -29,9 +30,9 @@ describe OtherCollectionsController, :type => :controller do
29
30
  end
30
31
 
31
32
  describe "#show" do
32
- let(:asset1) { Member.create!(title: "First of the Assets") }
33
- let(:asset2) { Member.create!(title: "Second of the Assets") }
34
- let(:asset3) { Member.create!(title: "Third of the Assets") }
33
+ let(:asset1) { Member.create!(title: "First of the Assets", read_users: [user.user_key]) }
34
+ let(:asset2) { Member.create!(title: "Second of the Assets", read_users: [user.user_key]) }
35
+ let(:asset3) { Member.create!(title: "Third of the Assets", read_users: [user.user_key]) }
35
36
  let(:collection) do
36
37
  OtherCollection.create(id: 'foo123', title: "My collection",
37
38
  members: [asset1, asset2, asset3]) do |collection|
@@ -5,7 +5,9 @@ require 'engine_cart/rake_task'
5
5
 
6
6
  Jettywrapper.hydra_jetty_version = "v8.1.0"
7
7
 
8
- RSpec::Core::RakeTask.new(:spec)
8
+ RSpec::Core::RakeTask.new(:spec) do |spec|
9
+ spec.rspec_opts = ['--backtrace'] if ENV['CI']
10
+ end
9
11
 
10
12
  desc 'Spin up hydra-jetty and run specs'
11
13
  task ci: ['engine_cart:clean', 'engine_cart:generate', 'jetty:clean'] do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hydra-collections
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 5.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carolyn Cole
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-09 00:00:00.000000000 Z
11
+ date: 2015-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hydra-head