hydra-access-controls 10.4.0.rc1 → 10.4.0.rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/models/hydra/access_controls/permission.rb +9 -0
- data/spec/unit/permissions_spec.rb +14 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2d3c85cac502de5b1ce3a62a480e2730a5ede56
|
4
|
+
data.tar.gz: e4af0ac0eee5980169cf512b87a04c9845911e79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7511595c56d121f3d052aff20383c2ffd2fe793e35a897469e6204817bae45ad7cd1709d418438aaaa95a560069b82ac3378188a439b53f5a64ccd7da3d14a55
|
7
|
+
data.tar.gz: 6559c49c932f00957666a66764cffef4011b424f0f1f5d08baa963dc8533d025d752a757f4a4cc51dbeac1d6a9c7e7a07fb6e3059c14d5a5f86a61768dc73a60
|
@@ -44,6 +44,15 @@ module Hydra::AccessControls
|
|
44
44
|
URI.decode(parsed_agent.last)
|
45
45
|
end
|
46
46
|
|
47
|
+
def update(*)
|
48
|
+
super.tap { reset }
|
49
|
+
end
|
50
|
+
|
51
|
+
def reset
|
52
|
+
@access = nil
|
53
|
+
@parsed_agent = nil
|
54
|
+
end
|
55
|
+
|
47
56
|
def access
|
48
57
|
@access ||= mode.first.rdf_subject.to_s.split('#').last.downcase.sub('write', 'edit')
|
49
58
|
end
|
@@ -46,10 +46,23 @@ describe Hydra::AccessControls::Permissions do
|
|
46
46
|
|
47
47
|
describe "updating permissions" do
|
48
48
|
describe "with nested attributes" do
|
49
|
+
let(:original_permissions) { [{ type: "person", access: "edit", name: "jcoyne" }] }
|
49
50
|
before do
|
50
51
|
subject.save!
|
51
|
-
subject.permissions_attributes =
|
52
|
+
subject.permissions_attributes = original_permissions
|
52
53
|
end
|
54
|
+
|
55
|
+
context "with ids" do
|
56
|
+
let(:permission_id) { ActiveFedora::Base.uri_to_id(subject.permissions.last.rdf_subject.to_s) }
|
57
|
+
it "clears the cache" do
|
58
|
+
expect {
|
59
|
+
subject.permissions_attributes = [{ id: permission_id, type: "person", access: "read", name: "jcoyne" }]
|
60
|
+
}.to change { subject.permissions.map(&:to_hash) }
|
61
|
+
.from(original_permissions)
|
62
|
+
.to([{ type: "person", access: "read", name: "jcoyne" }])
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
53
66
|
context "when a hash is passed" do
|
54
67
|
before do
|
55
68
|
subject.permissions_attributes = {'0' => { type: "group", access:"read", name:"group1" },
|
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: 10.4.0.
|
4
|
+
version: 10.4.0.rc2
|
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: 2017-01-
|
13
|
+
date: 2017-01-25 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|