hydra-access-controls 6.1.1 → 6.2.0

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: 58301ec96589566100dbd7d7d310f9750186e3b0
4
- data.tar.gz: 78a503ad56405a2cfa3c830e54f6d896b4c69114
3
+ metadata.gz: 8aa9a9ba62eeb9030329ff121f35ea64ce5833b6
4
+ data.tar.gz: 3801bd2b2a23ce8e62a7af0d522b16a7f49f7794
5
5
  SHA512:
6
- metadata.gz: 3a28c79e951cc47c9058752cc1ffc8fe423704d3309ee9f27e0ae1041a341125fd56c0438385ead60632c62614d2a7d88d73bdf4144639748b8659d1ef288352
7
- data.tar.gz: f92e65fcb47e2ecb3ab1752faa8ce43e9d976fa5985be0ec142628a9654fd0f6a03f8fbd07f3540dd99ee35dc851d597791dba745f9ddeb8c504bb009d183c98
6
+ metadata.gz: 71123bf8489eca05d1eb124a7b815b7e97148cd6bac7e9886dbc1613cba2735312fae40c90129cc297f47032b65fccc896d63d1233c3077ceccbb869a8885197
7
+ data.tar.gz: fcea17d03eae35064878aa41691c5d923d65f3765d8175ce16ae207512e5f10a09a8fa2e7916ec168b510566f8e8f3c462e8325a070a4f9a0eeaa8e902a5a1a4
@@ -89,9 +89,13 @@ module Hydra::AccessControlsEnforcement
89
89
 
90
90
 
91
91
  # Which permission levels (logical OR) will grant you the ability to discover documents in a search.
92
+
92
93
  # Override this method if you want it to be something other than the default
93
94
  def discovery_permissions
94
- ["edit","discover","read"]
95
+ @discovery_permissions ||= ["edit","discover","read"]
96
+ end
97
+ def disocvery_permissions= (permissions)
98
+ @discovery_permissions = permissions
95
99
  end
96
100
 
97
101
  # Contrller before filter that sets up access-controlled lucene query in order to provide gated discovery behavior
@@ -187,7 +187,10 @@ module Hydra
187
187
  vals = read_access.machine.person
188
188
  solr_doc[ActiveFedora::SolrService.solr_name('read_access_person', indexer)] = vals unless vals.empty?
189
189
 
190
- ::Solrizer::Extractor.insert_solr_field_value(solr_doc, "embargo_release_date_dt", embargo_release_date(:format=>:solr_date)) if embargo_release_date
190
+ if embargo_release_date
191
+ embargo_release_date_solr_key_name = ActiveFedora::SolrService.solr_name("embargo_release_date", date_indexer)
192
+ ::Solrizer::Extractor.insert_solr_field_value(solr_doc, embargo_release_date_solr_key_name , embargo_release_date(:format=>:solr_date))
193
+ end
191
194
  solr_doc
192
195
  end
193
196
 
@@ -35,6 +35,14 @@ describe Hydra::AccessControlsEnforcement do
35
35
  @solr_parameters[:fq].first.should_not match(/registered/)
36
36
  end
37
37
  it "Then I should not have individual or group permissions"
38
+ it "Should changed based on the discovery_perissions" do
39
+ @solr_parameters = {}
40
+ discovery_permissions = ["read","edit"]
41
+ subject.send(:apply_gated_discovery, @solr_parameters, @user_parameters)
42
+ ["edit","read"].each do |type|
43
+ @solr_parameters[:fq].first.should match(/#{type}_access_group_ssim\:public/)
44
+ end
45
+ end
38
46
  end
39
47
  context "Given I am a registered user" do
40
48
  before do
@@ -64,6 +72,16 @@ describe Hydra::AccessControlsEnforcement do
64
72
  end
65
73
  end
66
74
  end
75
+ it "Should changed based on the discovery_perissions" do
76
+ @solr_parameters = {}
77
+ discovery_permissions = ["read","edit"]
78
+ subject.send(:apply_gated_discovery, @solr_parameters, @user_parameters)
79
+ ["faculty", "africana-faculty"].each do |group_id|
80
+ ["edit","read"].each do |type|
81
+ @solr_parameters[:fq].first.should match(/#{type}_access_group_ssim\:#{group_id}/)
82
+ end
83
+ end
84
+ end
67
85
  end
68
86
  end
69
87
 
@@ -54,18 +54,21 @@ describe Hydra::ModelMixins::RightsMetadata do
54
54
  end
55
55
 
56
56
  context "to_solr" do
57
+ let(:embargo_release_date) { "2010-12-01" }
57
58
  before do
59
+ subject.rightsMetadata.embargo_release_date = embargo_release_date
58
60
  subject.rightsMetadata.update_permissions("person"=>{"person1"=>"read","person2"=>"discover"}, "group"=>{'group-6' => 'read', "group-7"=>'read', 'group-8'=>'edit'})
59
61
  end
60
62
  it "should produce a solr document" do
61
63
  result = subject.rightsMetadata.to_solr
62
- result.size.should == 4
64
+ result.size.should == 5
63
65
  ## Wrote the test in this way, because the implementation uses a hash, and the hash order is not deterministic (especially in ruby 1.8.7)
64
66
  result['read_access_group_ssim'].size.should == 2
65
67
  result['read_access_group_ssim'].should include('group-6', 'group-7')
66
68
  result['edit_access_group_ssim'].should == ['group-8']
67
69
  result['discover_access_person_ssim'].should == ['person2']
68
70
  result['read_access_person_ssim'].should == ['person1']
71
+ result['embargo_release_date_dtsi'].should == subject.rightsMetadata.embargo_release_date(:format => :solr_date)
69
72
  end
70
73
  end
71
74
 
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: 6.1.1
4
+ version: 6.2.0
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: 2013-05-09 00:00:00.000000000 Z
13
+ date: 2013-05-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport