hydra-access-controls 8.2.0 → 9.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.textile +10 -10
- data/app/models/concerns/hydra/access_controls/access_right.rb +3 -2
- data/app/models/concerns/hydra/access_controls/embargoable.rb +120 -132
- data/app/models/concerns/hydra/access_controls/permissions.rb +137 -103
- data/app/models/concerns/hydra/access_controls/visibility.rb +3 -5
- data/app/models/concerns/hydra/access_controls.rb +0 -1
- data/app/models/concerns/hydra/admin_policy_behavior.rb +27 -2
- data/app/models/concerns/hydra/rights.rb +15 -0
- data/app/models/hydra/access_controls/access_control_list.rb +17 -0
- data/app/models/hydra/access_controls/embargo.rb +65 -0
- data/app/models/hydra/access_controls/lease.rb +66 -0
- data/app/models/hydra/access_controls/permission.rb +85 -0
- data/app/vocabularies/acl.rb +12 -0
- data/app/vocabularies/hydra/acl.rb +20 -0
- data/config/fedora.yml +4 -2
- data/hydra-access-controls.gemspec +6 -7
- data/lib/hydra/ability.rb +45 -43
- data/lib/hydra/access_controls_enforcement.rb +23 -25
- data/lib/hydra/admin_policy.rb +34 -11
- data/lib/hydra/config.rb +4 -15
- data/lib/hydra/permissions_query.rb +2 -2
- data/lib/hydra/permissions_solr_document.rb +4 -6
- data/lib/hydra/policy_aware_ability.rb +56 -53
- data/lib/hydra/policy_aware_access_controls_enforcement.rb +28 -18
- data/lib/hydra-access-controls.rb +1 -1
- data/spec/factories.rb +15 -15
- data/spec/services/embargo_service_spec.rb +6 -6
- data/spec/services/lease_service_spec.rb +6 -6
- data/spec/spec_helper.rb +20 -13
- data/spec/support/mods_asset.rb +3 -3
- data/spec/unit/ability_spec.rb +96 -121
- data/spec/unit/access_controls_enforcement_spec.rb +29 -27
- data/spec/unit/access_right_spec.rb +6 -1
- data/spec/unit/accessible_by_spec.rb +14 -5
- data/spec/unit/admin_policy_spec.rb +99 -92
- data/spec/unit/config_spec.rb +14 -15
- data/spec/unit/embargoable_spec.rb +26 -28
- data/spec/unit/permission_spec.rb +36 -16
- data/spec/unit/permissions_spec.rb +121 -65
- data/spec/unit/policy_aware_ability_spec.rb +64 -78
- data/spec/unit/policy_aware_access_controls_enforcement_spec.rb +81 -77
- data/spec/unit/role_mapper_spec.rb +10 -10
- data/spec/unit/with_access_right_spec.rb +1 -1
- metadata +29 -51
- data/lib/hydra/access_controls/permission.rb +0 -40
- data/lib/hydra/datastream/inheritable_rights_metadata.rb +0 -22
- data/lib/hydra/datastream/rights_metadata.rb +0 -276
- data/lib/hydra/datastream.rb +0 -7
- data/spec/unit/hydra_rights_metadata_persistence_spec.rb +0 -71
- data/spec/unit/hydra_rights_metadata_spec.rb +0 -301
- data/spec/unit/inheritable_rights_metadata_spec.rb +0 -65
@@ -1,65 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
-
|
3
|
-
describe Hydra::Datastream::InheritableRightsMetadata do
|
4
|
-
before do
|
5
|
-
Hydra.stub(:config).and_return(
|
6
|
-
Hydra::Config.new.tap do |config|
|
7
|
-
config.permissions ={
|
8
|
-
:discover => {:group =>"discover_access_group_ssim", :individual=>"discover_access_person_ssim"},
|
9
|
-
:read => {:group =>"read_access_group_ssim", :individual=>"read_access_person_ssim"},
|
10
|
-
:edit => {:group =>"edit_access_group_ssim", :individual=>"edit_access_person_ssim"},
|
11
|
-
:owner => "depositor_ssim",
|
12
|
-
:embargo_release_date => "embargo_release_date_dtsi",
|
13
|
-
|
14
|
-
:inheritable => {
|
15
|
-
:discover => {:group =>"inheritable_discover_access_group_ssim", :individual=>"inheritable_discover_access_person_ssim"},
|
16
|
-
:read => {:group =>"inheritable_read_access_group_ssim", :individual=>"inheritable_read_access_person_ssim"},
|
17
|
-
:edit => {:group =>"inheritable_edit_access_group_ssim", :individual=>"inheritable_edit_access_person_ssim"},
|
18
|
-
:owner => "inheritable_depositor_ssim",
|
19
|
-
:embargo_release_date => "inheritable_embargo_release_date_dtsi"
|
20
|
-
}
|
21
|
-
}
|
22
|
-
end
|
23
|
-
)
|
24
|
-
end
|
25
|
-
|
26
|
-
before(:each) do
|
27
|
-
# The way RubyDora loads objects prevents us from stubbing the fedora connection :(
|
28
|
-
# ActiveFedora::RubydoraConnection.stubs(:instance).returns(stub_everything())
|
29
|
-
obj = ActiveFedora::Base.new
|
30
|
-
@sample = Hydra::Datastream::InheritableRightsMetadata.new(obj.inner_object, nil)
|
31
|
-
@sample.stub(:content).and_return('')
|
32
|
-
|
33
|
-
@sample.permissions({:group=>"africana-faculty"}, "edit")
|
34
|
-
@sample.permissions({:group=>"cool-kids"}, "edit")
|
35
|
-
@sample.permissions({:group=>"slightly-cool-kids"}, "read")
|
36
|
-
@sample.permissions({:group=>"posers"}, "discover")
|
37
|
-
@sample.permissions({:person=>"julius_caesar"}, "edit")
|
38
|
-
@sample.permissions({:person=>"nero"}, "read")
|
39
|
-
@sample.permissions({:person=>"constantine"}, "discover")
|
40
|
-
@sample.embargo_release_date = "2102-10-01"
|
41
|
-
end
|
42
|
-
|
43
|
-
describe "to_solr" do
|
44
|
-
subject {@sample.to_solr}
|
45
|
-
it "should NOT provide normal solr permissions fields" do
|
46
|
-
subject.should_not have_key( Hydra.config[:permissions][:discover][:group] )
|
47
|
-
subject.should_not have_key( Hydra.config[:permissions][:discover][:individual] )
|
48
|
-
subject.should_not have_key( Hydra.config[:permissions][:read][:group] )
|
49
|
-
subject.should_not have_key( Hydra.config[:permissions][:read][:individual] )
|
50
|
-
subject.should_not have_key( Hydra.config[:permissions][:edit][:group] )
|
51
|
-
subject.should_not have_key( Hydra.config[:permissions][:edit][:individual] )
|
52
|
-
subject.should_not have_key( Hydra.config[:permissions][:embargo_release_date] )
|
53
|
-
end
|
54
|
-
it "should provide prefixed/inherited solr permissions fields" do
|
55
|
-
subject[Hydra.config[:permissions][:inheritable][:discover][:group] ].should == ["posers"]
|
56
|
-
subject[Hydra.config[:permissions][:inheritable][:discover][:individual] ].should == ["constantine"]
|
57
|
-
subject[Hydra.config[:permissions][:inheritable][:read][:group] ].should == ["slightly-cool-kids"]
|
58
|
-
subject[Hydra.config[:permissions][:inheritable][:read][:individual] ].should == ["nero"]
|
59
|
-
subject[Hydra.config[:permissions][:inheritable][:edit][:group] ].should == ["africana-faculty", "cool-kids"]
|
60
|
-
subject[Hydra.config[:permissions][:inheritable][:edit][:individual] ].should == ["julius_caesar"]
|
61
|
-
expect(subject[Hydra.config[:permissions][:inheritable][:embargo_release_date]]).to eq Date.parse("2102-10-01").to_time.utc.iso8601
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
end
|