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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/dor/rights_auth.rb +16 -1
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f3461a34cc8edcf7b4362d1c6c58304bbe43a82fbd9edd16452ec02cf8a40204
4
- data.tar.gz: 826e6ef53e3fec66cb97b1ab385793b9727ddc82bd81be1add9c46d285183303
3
+ metadata.gz: 60b3d1ae87e3950792e247f96ea41245ef998ff8db8c17f081eb310faec851dd
4
+ data.tar.gz: 531ea2c07aff3cb9a9a87076123ac43be63f4e0a834c4c5677ad7f4c3756bba0
5
5
  SHA512:
6
- metadata.gz: 196996c12540e5e17907865aabdff51c36afca65d59781d6cf08660d7c422b8bd26fefd699bc211c02ffc51e97ada62331fc19a701f5b39c5a9e15b90a1248f0
7
- data.tar.gz: 9dd9fa090720a1f4cdf5f9673513153ae3d41a63b57aaac99385353f26c9e4d3e1fa0e8309d863d1c0f01ab29302a4b4def2ee0730336ee72ace62f920ab9477
6
+ metadata.gz: cc78bc626716818af2369ee0221de05418d1feaf65a87249594497b353b01010825c13bcc6a0ca4e6f26bfe1558bde6e49b8f8cc2fd6a28acd8dfaa8a1fb51cf
7
+ data.tar.gz: 5db61b24e0a5e24a46e264b610144d58af26bc0b5538799d8811e4aece667dcc30e23e6bd58efbc04958e4189048a514a7d5322d8f016811083685ba5c691029
@@ -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.5.0
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-08-26 00:00:00.000000000 Z
14
+ date: 2020-09-01 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: nokogiri