ddr-models 2.0.0.rc3 → 2.0.0.rc4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 11a42d52d26394cfb4c5b2ce83b07a376a038ca5
4
- data.tar.gz: 7126eba821b4752622f03747c12194ee5298ba37
3
+ metadata.gz: 020b6e60553192eb502a3aba93595a4b98efc94c
4
+ data.tar.gz: 867e06bb256fd8d50df22ca7b129fa853aa24c86
5
5
  SHA512:
6
- metadata.gz: dc0839497afa48bb0a7fe0c0eda51678f8a9218fab2b7cf1b4c9f1e5c4d20d715b7e9e94bb910028b5aa8b13984a6cfe0bec1c4345811c91d2a01d268e920ee5
7
- data.tar.gz: 730e4a441a4b8e2f2894226b09b463ef63812d9b50b9afdbfef0e40851e73c2e3e8754e6621921c9d4006ecb2f243dda41e0173851a1fcb42294a08880d9d503
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 PIDs for policies on which any of the current user's agent has a role in policy scope
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 |pids|
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: "id")
28
- results.each_with_object(pids) { |r, memo| memo << r["id"] }
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
 
@@ -1,5 +1,5 @@
1
1
  module Ddr
2
2
  module Models
3
- VERSION = "2.0.0.rc3"
3
+ VERSION = "2.0.0.rc4"
4
4
  end
5
5
  end
@@ -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 PIDs for collections on which the current ability has a role" do
35
- expect(subject.policy_role_policies).to match_array([collections[0].pid, collections[1].pid])
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 PIDs" do
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.rc3
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-29 00:00:00.000000000 Z
12
+ date: 2015-07-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails