dor-rights-auth 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dor/rights_auth.rb +26 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 155c15e0037ba6d647c2926ab7d83c01eb28902e
|
4
|
+
data.tar.gz: b3ea1d4f93bf56722f103d88f11dddd20b05cc77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 758a25ecd5845ec8e39d6bb23359c200d92f5ee77f6c37556afad96b63aa130b172b892abe6bc6b51479d4f90548f8470c6432004585c1ba9e3b5eab14690f18
|
7
|
+
data.tar.gz: 3d0f06f1fd0e34302c8a1010e3f7f4bff3e07750298421d0eafa3ffaf843c1c1cac391d48cee3a0ec560482a6eca2e41d1b0be354c46175baa5766b3ae8dcd6e
|
data/lib/dor/rights_auth.rb
CHANGED
@@ -49,6 +49,31 @@ module Dor
|
|
49
49
|
@embargoed
|
50
50
|
end
|
51
51
|
|
52
|
+
# summary level rights info is mostly used for object-level indexing/faceting.
|
53
|
+
# thus, we currently only calculate it when parsing object rights for indexing.
|
54
|
+
# to keep from having to refactor or duplicate code right now, we'll just leverage
|
55
|
+
# what we've got, checking whether index_elements is populated, and raising an error
|
56
|
+
# if the object wasn't instantiated in a way that makes those calculations.
|
57
|
+
def check_index_elements_calculated!
|
58
|
+
unless index_elements.size > 0
|
59
|
+
raise "primary access rights not calculated. instantiate by calling '.parse(xml, forindex = true)'."
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# this is just a convenience method for asking whether an object's rights would
|
64
|
+
# classify it as 'dark'.
|
65
|
+
def dark?
|
66
|
+
check_index_elements_calculated!
|
67
|
+
index_elements[:primary] == 'dark'
|
68
|
+
end
|
69
|
+
|
70
|
+
# this is just a convenience method for asking whether an object's rights would
|
71
|
+
# classify it as 'citation only'.
|
72
|
+
def citation_only?
|
73
|
+
check_index_elements_calculated!
|
74
|
+
index_elements[:primary] == 'citation'
|
75
|
+
end
|
76
|
+
|
52
77
|
# Returns true if the object is world readable AND has no rule attribute
|
53
78
|
# @return [Boolean]
|
54
79
|
def world_unrestricted?
|
@@ -277,7 +302,7 @@ module Dor
|
|
277
302
|
def self.extract_index_terms(doc)
|
278
303
|
terms = []
|
279
304
|
machine = doc.at_xpath("//rightsMetadata/access[@type='read' and not(file)]/machine")
|
280
|
-
terms.push 'none_discover' if doc.at_xpath("//rightsMetadata/access[@type='discover']/machine/none")
|
305
|
+
terms.push 'none_discover' if doc.at_xpath("//rightsMetadata/access[@type='discover']/machine/none") || doc.at_xpath("//rightsMetadata/access[@type='discover']/machine[not(*)]")
|
281
306
|
terms.push 'world_discover' if doc.at_xpath("//rightsMetadata/access[@type='discover']/machine/world[not(@rule)]")
|
282
307
|
return terms if machine.nil?
|
283
308
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dor-rights-auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Willy Mene
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-08-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -130,9 +130,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
130
|
version: 1.3.6
|
131
131
|
requirements: []
|
132
132
|
rubyforge_project:
|
133
|
-
rubygems_version: 2.
|
133
|
+
rubygems_version: 2.6.13
|
134
134
|
signing_key:
|
135
135
|
specification_version: 4
|
136
136
|
summary: Parses rightsMetadata xml into a useable object
|
137
137
|
test_files: []
|
138
|
-
has_rdoc:
|