ddr-models 2.0.0.rc3 → 2.0.0.rc4
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 020b6e60553192eb502a3aba93595a4b98efc94c
|
4
|
+
data.tar.gz: 867e06bb256fd8d50df22ca7b129fa853aa24c86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd13a10378603fba054c18241403870e2d73859774116a1b3a1580d641075e1e962e518a2bee882ae364590ef310f3ef76ecaaaf89efd4421f868e380bff0b1c
|
7
|
+
data.tar.gz: 328a95d896b257a194be234d473a86e3cd2a3917f6e540e021f1ae59495fc26b5651ee84a2b9d1d391e71e71f76e94e8c1c34dd2ee5c820b1d57fe2664323f22
|
@@ -17,15 +17,15 @@ module Ddr
|
|
17
17
|
@current_ability ||= AbilityFactory.call(current_user, request.env)
|
18
18
|
end
|
19
19
|
|
20
|
-
# List of
|
20
|
+
# List of URIs for policies on which any of the current user's agent has a role in policy scope
|
21
21
|
def policy_role_policies
|
22
|
-
@policy_role_policies ||= Array.new.tap do |
|
22
|
+
@policy_role_policies ||= Array.new.tap do |uris|
|
23
23
|
filters = current_ability.agents.map do |agent|
|
24
24
|
"#{Ddr::IndexFields::POLICY_ROLE}:\"#{agent}\""
|
25
25
|
end.join(" OR ")
|
26
26
|
query = "#{Ddr::IndexFields::ACTIVE_FEDORA_MODEL}:Collection AND (#{filters})"
|
27
|
-
results = ActiveFedora::SolrService.query(query, rows: Collection.count, fl:
|
28
|
-
results.each_with_object(
|
27
|
+
results = ActiveFedora::SolrService.query(query, rows: Collection.count, fl: Ddr::IndexFields::INTERNAL_URI)
|
28
|
+
results.each_with_object(uris) { |r, memo| memo << r[Ddr::IndexFields::INTERNAL_URI] }
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
data/lib/ddr/models/version.rb
CHANGED
@@ -31,17 +31,17 @@ RSpec.describe ApplicationController, type: :controller do
|
|
31
31
|
collections[2].roles.grant type: "Viewer", agent: "foo:bar", scope: "policy"
|
32
32
|
collections[2].save
|
33
33
|
end
|
34
|
-
it "should return a list of
|
35
|
-
expect(subject.policy_role_policies).to match_array([collections[0].
|
34
|
+
it "should return a list of internal URIs for collections on which the current ability has a role" do
|
35
|
+
expect(subject.policy_role_policies).to match_array([collections[0].internal_uri, collections[1].internal_uri])
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
39
|
describe "#policy_role_filters" do
|
40
40
|
before do
|
41
|
-
allow(subject).to receive(:policy_role_policies) { ["test:13", "test:45"] }
|
41
|
+
allow(subject).to receive(:policy_role_policies) { ["info:fedora/test:13", "info:fedora/test:45"] }
|
42
42
|
end
|
43
|
-
it "should include clauses for is_governed_by relationships to the #policy_role_policies
|
44
|
-
expect(subject.policy_role_filters).to eq("_query_:\"{!raw f=#{Ddr::IndexFields::IS_GOVERNED_BY}}test:13\" OR _query_:\"{!raw f=#{Ddr::IndexFields::IS_GOVERNED_BY}}test:45\"")
|
43
|
+
it "should include clauses for is_governed_by relationships to the #policy_role_policies" do
|
44
|
+
expect(subject.policy_role_filters).to eq("_query_:\"{!raw f=#{Ddr::IndexFields::IS_GOVERNED_BY}}info:fedora/test:13\" OR _query_:\"{!raw f=#{Ddr::IndexFields::IS_GOVERNED_BY}}info:fedora/test:45\"")
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ddr-models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.rc4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jim Coble
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-07-
|
12
|
+
date: 2015-07-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|