hydra-access-controls 6.4.0 → 6.4.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: 550f14aaf46093d42a43ab926b41d29c00ec370d
4
- data.tar.gz: de0348503df87083363d268918cda3c9060f3649
3
+ metadata.gz: 1c7889e840d3022c5487081cbb7e11c7abad06ab
4
+ data.tar.gz: b8323dbda12665dc1ee7d29bcc5b194dcd09f7fa
5
5
  SHA512:
6
- metadata.gz: 6c317e27b93d56b80332b0a0d52a91a0141afbff106b89e429109ea664d63e1546a29307b2fa9d69ee93b89cab0ff823bd694d0e9f732d7fbe6a7780ef555bda
7
- data.tar.gz: af750abded990c0d4bf727f74f005e11aee1cc199fa3c752a0b5c3cd139cd41866fc2412d003a98f89fc8827adf394aee51e319f04aa3574f9b2f200976aacb0
6
+ metadata.gz: b8e37c30ce82f7a2ac0c5f3d737ccc76ac0001675486d5bce88212b65ab786af187df510552ab05329f5da2e90da036e0e2022430d9c53f5c48aae4fd01198e9
7
+ data.tar.gz: 8b6be814f5af9b0c997c2dff7bbaa2c1a0f568135da51bc6411f92ef3555fa2271fd0228187d1f4d9d1111c9b5c2bb0104659f6197357bb31f3dbb08f7ec5bd8
@@ -22,10 +22,6 @@ module Hydra::AccessControlsEnforcement
22
22
  permission_types = discovery_permissions
23
23
  user_access_filters = []
24
24
 
25
- permission_types.each do |type|
26
- user_access_filters << ActiveFedora::SolrService.solr_name("#{type}_access_group", Hydra::Datastream::RightsMetadata.indexer) + ":public"
27
- end
28
-
29
25
  # Grant access based on user id & role
30
26
  solr_access_filters_logic.each do |method_name|
31
27
  user_access_filters += send(method_name, permission_types)
@@ -143,9 +143,11 @@ module Hydra
143
143
  # @param params ex. {"group"=>{"group1"=>"discover","group2"=>"edit"}, "person"=>{"person1"=>"read","person2"=>"discover"}}
144
144
  # Restricts actor type to group or person. Any others will be ignored
145
145
  def permissions= (params)
146
- group_ids = groups.keys | params['group'].keys
146
+ groups_for_update = params['group'] ? params['group'].keys : []
147
+ group_ids = groups.keys | groups_for_update
147
148
  group_ids.each {|group_id| self.permissions({"group"=>group_id}, params['group'].fetch(group_id, 'none'))}
148
- user_ids = individuals.keys | params['person'].keys
149
+ users_for_update = params['person'] ? params['person'].keys : []
150
+ user_ids = individuals.keys | users_for_update
149
151
  user_ids.each {|person_id| self.permissions({"person"=>person_id}, params['person'].fetch(person_id, 'none'))}
150
152
  end
151
153
 
@@ -27,9 +27,7 @@ describe Hydra::AccessControlsEnforcement do
27
27
  subject.send(:apply_gated_discovery, @solr_parameters, @user_parameters)
28
28
  end
29
29
  it "Then I should be treated as a member of the 'public' group" do
30
- ["discover","edit","read"].each do |type|
31
- @solr_parameters[:fq].first.should match(/#{type}_access_group_ssim\:public/)
32
- end
30
+ expect(@solr_parameters[:fq].first).to eq 'edit_access_group_ssim:public OR discover_access_group_ssim:public OR read_access_group_ssim:public'
33
31
  end
34
32
  it "Then I should not be treated as a member of the 'registered' group" do
35
33
  @solr_parameters[:fq].first.should_not match(/registered/)
@@ -31,6 +31,12 @@ describe Hydra::Datastream::RightsMetadata do
31
31
 
32
32
  describe "permissions" do
33
33
  describe "setter" do
34
+ it "should set person permissions" do
35
+ @sample.permissions = {"person"=>{"maria"=>"read","marcus"=>"discover"}}
36
+ end
37
+ it "should set group permissions" do
38
+ @sample.permissions = {"group"=>{"librarians"=>"read","students"=>"discover"}}
39
+ end
34
40
  it "should create/update/delete permissions for the given user/group" do
35
41
  @sample.class.terminology.xpath_for(:access, :person, "person_123").should == '//oxns:access/oxns:machine/oxns:person[contains(., "person_123")]'
36
42
 
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.4.0
4
+ version: 6.4.1
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-10-17 00:00:00.000000000 Z
13
+ date: 2013-11-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -191,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
191
  version: '0'
192
192
  requirements: []
193
193
  rubyforge_project:
194
- rubygems_version: 2.1.7
194
+ rubygems_version: 2.0.3
195
195
  signing_key:
196
196
  specification_version: 4
197
197
  summary: Access controls for project hydra