dor-rights-auth 1.5.0 → 1.6.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 +16 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60b3d1ae87e3950792e247f96ea41245ef998ff8db8c17f081eb310faec851dd
|
4
|
+
data.tar.gz: 531ea2c07aff3cb9a9a87076123ac43be63f4e0a834c4c5677ad7f4c3756bba0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc78bc626716818af2369ee0221de05418d1feaf65a87249594497b353b01010825c13bcc6a0ca4e6f26bfe1558bde6e49b8f8cc2fd6a28acd8dfaa8a1fb51cf
|
7
|
+
data.tar.gz: 5db61b24e0a5e24a46e264b610144d58af26bc0b5538799d8811e4aece667dcc30e23e6bd58efbc04958e4189048a514a7d5322d8f016811083685ba5c691029
|
data/lib/dor/rights_auth.rb
CHANGED
@@ -170,6 +170,12 @@ module Dor
|
|
170
170
|
@file[file_name].group[:stanford].value && (stanford_rule.nil? || stanford_rule != NO_DOWNLOAD_RULE)
|
171
171
|
end
|
172
172
|
|
173
|
+
def cdl_rights_for_file(file_name)
|
174
|
+
return controlled_digital_lending? if @file[file_name].nil? || @file[file_name].controlled_digital_lending.nil?
|
175
|
+
|
176
|
+
@file[file_name].controlled_digital_lending.value
|
177
|
+
end
|
178
|
+
|
173
179
|
# Returns whether an object-level world node exists, and the value of its rule attribute
|
174
180
|
# @return [Array<(Boolean, String)>] First value: existence of node. Second Value: rule attribute, nil otherwise
|
175
181
|
# @example Using multiple variable assignment to read both array elements
|
@@ -514,6 +520,7 @@ module Dor
|
|
514
520
|
access_with_files.each do |access_node|
|
515
521
|
stanford_access = Rights.new
|
516
522
|
world_access = Rights.new
|
523
|
+
controlled_digital_lending = Rights.new
|
517
524
|
if access_node.at_xpath("machine/group[#{CONTAINS_STANFORD_XPATH}]")
|
518
525
|
stanford_access.value = true
|
519
526
|
rule = access_node.at_xpath("machine/group[#{CONTAINS_STANFORD_XPATH}]/@rule")
|
@@ -527,6 +534,14 @@ module Dor
|
|
527
534
|
stanford_access.value = false
|
528
535
|
end
|
529
536
|
|
537
|
+
if access_node.at_xpath('machine/cdl')
|
538
|
+
controlled_digital_lending.value = true
|
539
|
+
rule = access_node.at_xpath('machine/cdl/@rule')
|
540
|
+
controlled_digital_lending.rule = rule.value if rule
|
541
|
+
else
|
542
|
+
controlled_digital_lending.value = false
|
543
|
+
end
|
544
|
+
|
530
545
|
if access_node.at_xpath('machine/world')
|
531
546
|
world_access.value = true
|
532
547
|
rule = access_node.at_xpath('machine/world/@rule')
|
@@ -566,7 +581,7 @@ module Dor
|
|
566
581
|
file_rights.group = { :stanford => stanford_access }
|
567
582
|
file_rights.agent = file_agents
|
568
583
|
file_rights.location = file_locations
|
569
|
-
|
584
|
+
file_rights.controlled_digital_lending = controlled_digital_lending
|
570
585
|
rights.file[f.content] = file_rights
|
571
586
|
end
|
572
587
|
end
|
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.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Willy Mene
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2020-
|
14
|
+
date: 2020-09-01 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: nokogiri
|