hydra-access-controls 10.4.0.rc1 → 10.4.0.rc2

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: 81f71a1cc06b6a7534f660864351689d42bcf25f
4
- data.tar.gz: b5cc13c664f4bfdd5ca77d3033bbfdceb5106dd2
3
+ metadata.gz: c2d3c85cac502de5b1ce3a62a480e2730a5ede56
4
+ data.tar.gz: e4af0ac0eee5980169cf512b87a04c9845911e79
5
5
  SHA512:
6
- metadata.gz: 4b6074c2e8ce4c4db2509118062c76711935285192bcc2c767a8b0fe9b7bc16bec77a1e81836d66585e16210ff3eb855d4a3bde015cc989854fa33db5ac1aa6c
7
- data.tar.gz: 138f70c4e3a0cd8f82cf09dfcd31fa9e0a11807971bc58b4e6445d0229d2e062198648300bb546de5e25cb29a991571fbb76e38e0bae964088918f0a3e140ee8
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 = [{ type: "person", access: "edit", name: "jcoyne" }]
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.rc1
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-24 00:00:00.000000000 Z
13
+ date: 2017-01-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport