ddr-core 1.2.0 → 1.3.0

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
  SHA256:
3
- metadata.gz: 7019ec71b3e1a704835530a69ff24d0df878f8bd35912c1382d9f919397c0af1
4
- data.tar.gz: 81689f7ce034a586b44eede21c541ba06f9f9f67a29294088f24717d5b52ecd5
3
+ metadata.gz: 61fa03b921f6c0f3b15a68938f568c4547f324facd5f57bf753ca5b28ae756e2
4
+ data.tar.gz: e74b196e266a1d4a21c24c90490374d2f7054fb52921623adba198bbc9948eca
5
5
  SHA512:
6
- metadata.gz: 5ba7058499d29ee97c27ae8480b82a0c5d8edc3a8cff1365a0de3f16ded3d72b60e83bc31d9badc892083d6920379b5c6c98941ea1adb29b36626d9e6bf2865b
7
- data.tar.gz: da5e331dd1770446db047867cb4e4c32fbb6488cffedb35c61df8230ad82d2e20fe565bb7000b2d4da88c9b1949c5fffc19471c1956dec4e5ea827cc958ae81d
6
+ metadata.gz: 95ab554ea0873c8b6f8db7ae981f0d6336d180731f91bfd57d19f8806682142fdc47bce3fb09a8aae485bd41e7e9389e0c4cf16fdfa992406032335350085041
7
+ data.tar.gz: 5239037ba065ed2034951311c260d988b19cbd45f3d2c2f6f10e78e9cd311e866e9fc7ca49619fca3de2ec791dea19942b41b4b22863383b9442456ade3ff0ac
data/Rakefile CHANGED
@@ -28,3 +28,8 @@ begin
28
28
  task default: :spec
29
29
  rescue LoadError
30
30
  end
31
+
32
+ # This allows our s2i builder image to work more smoothly
33
+ task 'tmp:create' do
34
+ Rake::Task['app:tmp:create'].invoke
35
+ end
@@ -0,0 +1,28 @@
1
+ module Ddr
2
+ module Embargoable
3
+ extend ActiveSupport::Concern
4
+
5
+ def embargo
6
+ result = available.present? ? available : parent&.available
7
+ normalize(result)
8
+ end
9
+
10
+ def embargoed?
11
+ !embargo.nil? && embargo > DateTime.now
12
+ end
13
+
14
+ private
15
+
16
+ def normalize(value)
17
+ case value
18
+ when ::Time
19
+ value.to_datetime
20
+ when ::Array
21
+ value.first
22
+ else
23
+ value
24
+ end
25
+ end
26
+
27
+ end
28
+ end
@@ -297,6 +297,14 @@ module Ddr
297
297
  resource.children
298
298
  end
299
299
 
300
+ def embargo
301
+ resource.embargo
302
+ end
303
+
304
+ def embargoed?
305
+ resource.embargoed?
306
+ end
307
+
300
308
  private
301
309
 
302
310
  def query_service
@@ -2,6 +2,7 @@ module Ddr
2
2
  class Component < Resource
3
3
 
4
4
  include Captionable
5
+ include Embargoable
5
6
  include HasContent
6
7
  include HasExtractedText
7
8
  include HasIntermediateFile
@@ -1,6 +1,7 @@
1
1
  module Ddr
2
2
  class Item < Resource
3
3
 
4
+ include Embargoable
4
5
  include HasChildren
5
6
  include HasParent
6
7
  include HasStructMetadata
@@ -98,6 +98,15 @@ module Ddr
98
98
  false
99
99
  end
100
100
 
101
+ # Embargoes are enforced by the `Embargoable` concern, which overrides the `embargo` and `embargoed?` methods
102
+ def embargo
103
+ nil
104
+ end
105
+
106
+ def embargoed?
107
+ false
108
+ end
109
+
101
110
  def has_admin_policy?
102
111
  governable? && admin_policy_id.present?
103
112
  end
@@ -35,6 +35,7 @@ module Ddr
35
35
  autoload :CollectionAbilityDefinitions
36
36
  autoload :ComponentAbilityDefinitions
37
37
  autoload :ItemAbilityDefinitions
38
+ autoload :EmbargoAbilityDefinitions
38
39
  autoload :PublicationAbilityDefinitions
39
40
  autoload :LockAbilityDefinitions
40
41
  autoload :RoleBasedAbilityDefinitions
@@ -8,6 +8,7 @@ module Ddr
8
8
  ComponentAbilityDefinitions,
9
9
  AttachmentAbilityDefinitions,
10
10
  RoleBasedAbilityDefinitions,
11
+ EmbargoAbilityDefinitions,
11
12
  PublicationAbilityDefinitions,
12
13
  LockAbilityDefinitions,
13
14
  AdminSetAbilityDefinitions,
@@ -0,0 +1,18 @@
1
+ module Ddr
2
+ module Auth
3
+ class EmbargoAbilityDefinitions < AbilityDefinitions
4
+
5
+ def call
6
+ cannot :read, [::SolrDocument, Ddr::Resource] do |obj|
7
+ obj.embargoed? && cannot?(:update, obj)
8
+ end
9
+
10
+ cannot :download, [::SolrDocument, Ddr::Resource] do |obj|
11
+ obj.embargoed? && cannot?(:update, obj)
12
+ end
13
+
14
+ end
15
+
16
+ end
17
+ end
18
+ end
@@ -23,7 +23,8 @@ module Ddr
23
23
  "MetadataEditor",
24
24
  "The Metadata Editor role conveys responsibility for " \
25
25
  "managing the description of a resource.",
26
- [ Permissions::DISCOVER, Permissions::READ, Permissions::DOWNLOAD, Permissions::UPDATE ]
26
+ [ Permissions::DISCOVER, Permissions::READ, Permissions::DOWNLOAD,
27
+ Permissions::UPDATE ]
27
28
  )
28
29
 
29
30
  CONTRIBUTOR = RoleType.new(
@@ -49,7 +50,7 @@ module Ddr
49
50
 
50
51
  METADATA_VIEWER = RoleType.new(
51
52
  "MetadataViewer",
52
- "The MetadataViewer role coveys access to the description of a resource.",
53
+ "The MetadataViewer role conveys access to the description of a resource.",
53
54
  [ Permissions::DISCOVER ]
54
55
  )
55
56
 
@@ -84,10 +84,13 @@ module Ddr
84
84
  '.aac' => 'audio/mp4',
85
85
  '.f4a' => 'audio/mp4',
86
86
  '.flv' => 'video/flv',
87
+ '.m2t' => 'video/vnd.dlna.mpeg-tts',
88
+ '.m2ts' => 'video/m2ts',
87
89
  '.m4a' => 'audio/mp4',
88
90
  '.mov' => 'video/quicktime',
89
91
  '.mp3' => 'audio/mpeg',
90
92
  '.mp4' => 'video/mp4',
93
+ '.mts' => 'video/vnd.dlna.mpeg-tts',
91
94
  '.oga' => 'audio/ogg',
92
95
  '.ogg' => 'audio/ogg',
93
96
  '.srt' => 'text/plain',
@@ -1,5 +1,5 @@
1
1
  module Ddr
2
2
  module Core
3
- VERSION = '1.2.0'
3
+ VERSION = '1.3.0'
4
4
  end
5
5
  end
@@ -16,6 +16,7 @@ module Ddr::Index
16
16
  ASPACE_ID = Field.new :aspace_id, :stored_sortable
17
17
  ATTACHED_FILES_HAVING_CONTENT = Field.new :attached_files_having_content, :symbol
18
18
  ATTACHED_TO_ID = Field.new :attached_to_id, :symbol
19
+ AVAILABLE = Field.new :available, :symbol
19
20
  BIBLICAL_BOOK_FACET = Field.new :biblical_book_facet, :facetable
20
21
  BOX_NUMBER_FACET = Field.new :box_number_facet, :facetable
21
22
  CATEGORY_FACET = Field.new :category_facet, :facetable
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ddr-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Coble
8
8
  - David Chandek-Stark
9
9
  - Ayse Durmaz
10
10
  - Hugh Cayless
11
- autorequire:
11
+ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2020-07-15 00:00:00.000000000 Z
14
+ date: 2020-10-27 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activeresource
@@ -306,9 +306,9 @@ files:
306
306
  - app/assets/config/ddr_core_manifest.js
307
307
  - app/controllers/users/omniauth_callbacks_controller.rb
308
308
  - app/controllers/users/sessions_controller.rb
309
- - app/models/concerns/ddr/#search_builder_behavior.rb#
310
309
  - app/models/concerns/ddr/captionable.rb
311
310
  - app/models/concerns/ddr/describable.rb
311
+ - app/models/concerns/ddr/embargoable.rb
312
312
  - app/models/concerns/ddr/governable.rb
313
313
  - app/models/concerns/ddr/has_admin_metadata.rb
314
314
  - app/models/concerns/ddr/has_attachments.rb
@@ -320,17 +320,12 @@ files:
320
320
  - app/models/concerns/ddr/has_parent.rb
321
321
  - app/models/concerns/ddr/has_struct_metadata.rb
322
322
  - app/models/concerns/ddr/has_thumbnail.rb
323
- - app/models/concerns/ddr/search_builder_behavior.rb~
324
323
  - app/models/concerns/ddr/solr_document_behavior.rb
325
324
  - app/models/concerns/ddr/streamable.rb
326
- - app/models/ddr/#admin_set.rb#
327
- - app/models/ddr/#auxiliary_resource_cache.rb#
328
325
  - app/models/ddr/admin_set.rb
329
326
  - app/models/ddr/alert.rb
330
327
  - app/models/ddr/attachment.rb
331
328
  - app/models/ddr/auxiliary_resource.rb
332
- - app/models/ddr/auxiliary_resource.rb~
333
- - app/models/ddr/cacheable_auxiliary_resource.rb~
334
329
  - app/models/ddr/collection.rb
335
330
  - app/models/ddr/component.rb
336
331
  - app/models/ddr/contact.rb
@@ -351,7 +346,6 @@ files:
351
346
  - db/migrate/20200207194453_add_default_to_lock_version.rb
352
347
  - lib/ddr-core.rb
353
348
  - lib/ddr/auth.rb
354
- - lib/ddr/auth/#duke_person.rb#
355
349
  - lib/ddr/auth/ability.rb
356
350
  - lib/ddr/auth/ability_definitions.rb
357
351
  - lib/ddr/auth/ability_definitions/admin_set_ability_definitions.rb
@@ -359,6 +353,7 @@ files:
359
353
  - lib/ddr/auth/ability_definitions/attachment_ability_definitions.rb
360
354
  - lib/ddr/auth/ability_definitions/collection_ability_definitions.rb
361
355
  - lib/ddr/auth/ability_definitions/component_ability_definitions.rb
356
+ - lib/ddr/auth/ability_definitions/embargo_ability_definitions.rb
362
357
  - lib/ddr/auth/ability_definitions/item_ability_definitions.rb
363
358
  - lib/ddr/auth/ability_definitions/lock_ability_definitions.rb
364
359
  - lib/ddr/auth/ability_definitions/publication_ability_definitions.rb
@@ -372,7 +367,6 @@ files:
372
367
  - lib/ddr/auth/auth_context.rb
373
368
  - lib/ddr/auth/auth_context_factory.rb
374
369
  - lib/ddr/auth/detached_auth_context.rb
375
- - lib/ddr/auth/duke_directory.rb~
376
370
  - lib/ddr/auth/dynamic_groups.rb
377
371
  - lib/ddr/auth/effective_permissions.rb
378
372
  - lib/ddr/auth/effective_roles.rb
@@ -447,7 +441,7 @@ licenses:
447
441
  - BSD-3-Clause
448
442
  metadata:
449
443
  allowed_push_host: https://rubygems.org
450
- post_install_message:
444
+ post_install_message:
451
445
  rdoc_options: []
452
446
  require_paths:
453
447
  - lib
@@ -462,8 +456,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
462
456
  - !ruby/object:Gem::Version
463
457
  version: '0'
464
458
  requirements: []
465
- rubygems_version: 3.0.8
466
- signing_key:
459
+ rubygems_version: 3.0.6
460
+ signing_key:
467
461
  specification_version: 4
468
462
  summary: Models used in the Duke Digital Repository
469
463
  test_files: []
@@ -1,10 +0,0 @@
1
- module Ddr
2
- module SearchBuilderBehavior
3
-
4
- def effective_role_filter(agents)
5
- # https://lucene.apache.org/solr/guide/7_7/other-parsers.html#term-query-parser
6
- "{!terms f=#{Ddr::Index::Fields::EFFECTIVE_ROLE} method=booleanQuery}#{agents.join(',')}"
7
- end
8
-
9
- end
10
- end
@@ -1,9 +0,0 @@
1
- module Ddr
2
- module SearchBuilderBehavior
3
-
4
- def effective_role_filter
5
-
6
- end
7
-
8
- end
9
- end
@@ -1,26 +0,0 @@
1
- module Ddr
2
- class AdminSet < AuxiliaryResource
3
-
4
- def self.call(obj)
5
- find_by_code(obj.admin_set)
6
- rescue ActiveResource::ResourceNotFound => e
7
- raise Ddr::NotFoundError, e
8
- end
9
-
10
- def self.find_by_code(code)
11
- return unless code
12
- new get(:find, code: code)
13
- end
14
-
15
- def self.keys
16
- with_cache("keys") do
17
- all.map(&:code)
18
- end
19
- end
20
-
21
- def to_s
22
- title
23
- end
24
-
25
- end
26
- end
@@ -1,34 +0,0 @@
1
- require 'active_resource'
2
-
3
- module Ddr
4
- class AuxiliaryResourceCache < ActiveSupport::Cache::MemoryStore
5
-
6
- def initialize
7
- @_cache =
8
- end
9
-
10
- def with(key, &block)
11
- begin
12
- cache.set(key, block.call)
13
- rescue ActiveResource::ServerError => e
14
- if cache.key?(key)
15
- Rails.logger.error(e)
16
- cache.get(key)
17
- else
18
- raise
19
- end
20
- end
21
- end
22
-
23
- private
24
-
25
- def get(key)
26
- @_cache[key]
27
- end
28
-
29
- def set(key, value)
30
- @_cache[key] = value
31
- end
32
-
33
- end
34
- end
@@ -1,13 +0,0 @@
1
- require 'active_resource'
2
-
3
- module Ddr
4
- #
5
- # Abstract superclass for resources bound to ddr-aux API data
6
- #
7
- class AuxiliaryResource < ActiveResource::Base
8
-
9
- # ActiveResource freezes `site` in subclasses
10
- self.site = Ddr.ddr_aux_api_url
11
-
12
- end
13
- end
@@ -1,20 +0,0 @@
1
- module Ddr
2
- module CacheableAuxiliaryResource
3
-
4
- def with_cache(key, &block)
5
- block.call.tap { |value| cache.write(key, value) }
6
- rescue ActiveResource::ServerError => e
7
- if value = cache.fetch(key)
8
- logger.error(e) if logger
9
- value
10
- else
11
- raise
12
- end
13
- end
14
-
15
- def cache
16
- @cache ||= ActiveSupport::Cache::MemoryStore.new
17
- end
18
-
19
- end
20
- end
@@ -1,9 +0,0 @@
1
- module Ddr::Auth
2
- class DukePerson
3
-
4
- def self.get(user)
5
-
6
- end
7
-
8
- end
9
- end
@@ -1,7 +0,0 @@
1
- module Ddr::Auth
2
- class DukeDirectory
3
-
4
-
5
-
6
- end
7
- end