hyrax 3.0.0.pre.rc4 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +41 -8
- data/.dassie/Gemfile +10 -5
- data/.dassie/config/cable.yml +1 -1
- data/.dassie/config/environments/development.rb +2 -0
- data/.dassie/config/environments/production.rb +1 -1
- data/.dassie/config/initializers/hyrax.rb +5 -0
- data/.dassie/config/initializers/riiif.rb +22 -20
- data/.dassie/config/redis.yml +1 -0
- data/.dassie/config/role_map.yml +2 -0
- data/.dassie/db/seeds.rb +9 -1
- data/.dassie/package.json +3 -5
- data/.dockerignore +4 -0
- data/.env +1 -2
- data/.rubocop.yml +4 -0
- data/CONTAINERS.md +21 -1
- data/Dockerfile +46 -17
- data/Gemfile +21 -27
- data/app/actors/hyrax/actors/base_actor.rb +1 -1
- data/app/actors/hyrax/actors/create_with_remote_files_actor.rb +89 -41
- data/app/actors/hyrax/actors/create_with_remote_files_ordered_members_actor.rb +7 -42
- data/app/actors/hyrax/actors/file_actor.rb +4 -2
- data/app/actors/hyrax/actors/file_set_actor.rb +18 -11
- data/app/controllers/concerns/hyrax/collections_controller_behavior.rb +20 -8
- data/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb +21 -9
- data/app/controllers/concerns/hyrax/leases_controller_behavior.rb +14 -5
- data/app/controllers/concerns/hyrax/works_controller_behavior.rb +38 -8
- data/app/controllers/hyrax/admin/permission_template_accesses_controller.rb +0 -4
- data/app/controllers/hyrax/admin/workflows_controller.rb +8 -2
- data/app/controllers/hyrax/dashboard/collection_members_controller.rb +13 -9
- data/app/controllers/hyrax/dashboard/collections_controller.rb +14 -14
- data/app/controllers/hyrax/file_sets_controller.rb +49 -13
- data/app/controllers/hyrax/permissions_controller.rb +3 -4
- data/app/controllers/hyrax/workflow_actions_controller.rb +3 -1
- data/app/forms/hyrax/forms/collection_form.rb +12 -6
- data/app/forms/hyrax/forms/dashboard/nest_collection_form.rb +24 -2
- data/app/forms/hyrax/forms/file_set_form.rb +46 -0
- data/app/forms/hyrax/forms/permission.rb +23 -0
- data/app/forms/hyrax/forms/permission_template_form.rb +8 -2
- data/app/forms/hyrax/forms/resource_form.rb +31 -13
- data/app/forms/hyrax/forms/work_form.rb +5 -2
- data/app/helpers/hyrax/batch_edits_helper.rb +3 -1
- data/app/helpers/hyrax/collections_helper.rb +88 -2
- data/app/helpers/hyrax/dashboard_helper_behavior.rb +16 -5
- data/app/helpers/hyrax/embargo_helper.rb +4 -0
- data/app/helpers/hyrax/file_set_helper.rb +25 -6
- data/app/helpers/hyrax/hyrax_helper_behavior.rb +8 -0
- data/app/helpers/hyrax/lease_helper.rb +4 -0
- data/app/helpers/hyrax/url_helper.rb +4 -1
- data/app/helpers/hyrax/work_form_helper.rb +53 -0
- data/app/indexers/hyrax/administrative_set_indexer.rb +18 -0
- data/app/indexers/hyrax/valkyrie_file_set_indexer.rb +118 -0
- data/app/indexers/hyrax/valkyrie_indexer.rb +10 -4
- data/app/indexers/hyrax/valkyrie_work_indexer.rb +3 -1
- data/app/inputs/controlled_vocabulary_input.rb +2 -5
- data/app/jobs/attach_files_to_work_job.rb +19 -10
- data/app/jobs/attach_files_to_work_with_ordered_members_job.rb +6 -5
- data/app/jobs/embargo_expiry_job.rb +7 -5
- data/app/jobs/file_set_attached_event_job.rb +6 -1
- data/app/jobs/ingest_local_file_job.rb +18 -2
- data/app/jobs/inherit_permissions_job.rb +9 -5
- data/app/jobs/lease_expiry_job.rb +6 -4
- data/app/models/admin_set.rb +6 -25
- data/app/models/collection_branding_info.rb +25 -9
- data/app/models/concerns/hyrax/ability.rb +14 -1
- data/app/models/concerns/hyrax/collection_behavior.rb +17 -44
- data/app/models/concerns/hyrax/embargoable.rb +24 -0
- data/app/models/concerns/hyrax/file_set/characterization.rb +18 -12
- data/app/models/concerns/hyrax/solr_document_behavior.rb +9 -46
- data/app/models/concerns/hyrax/suppressible.rb +5 -0
- data/app/models/concerns/hyrax/user.rb +9 -3
- data/app/models/concerns/hyrax/work_behavior.rb +1 -1
- data/app/models/hyrax/file_set.rb +7 -0
- data/app/models/hyrax/pcdm_collection.rb +1 -0
- data/app/models/hyrax/permission_template.rb +98 -12
- data/app/models/hyrax/virus_scanner.rb +27 -18
- data/app/models/hyrax/work.rb +2 -0
- data/app/models/job_io_wrapper.rb +1 -1
- data/app/models/sipity/agent.rb +1 -0
- data/app/models/sipity/entity.rb +30 -8
- data/app/models/sipity/workflow.rb +1 -0
- data/app/models/sipity.rb +42 -0
- data/app/presenters/hyrax/admin_set_options_presenter.rb +12 -8
- data/app/presenters/hyrax/admin_set_presenter.rb +5 -1
- data/app/presenters/hyrax/admin_set_selection_presenter.rb +116 -0
- data/app/presenters/hyrax/collection_presenter.rb +41 -20
- data/app/presenters/hyrax/file_set_presenter.rb +6 -1
- data/app/presenters/hyrax/file_usage.rb +3 -2
- data/app/presenters/hyrax/pcdm_member_presenter_factory.rb +119 -0
- data/app/presenters/hyrax/stats_usage_presenter.rb +2 -1
- data/app/presenters/hyrax/trophy_presenter.rb +33 -4
- data/app/presenters/hyrax/user_profile_presenter.rb +11 -1
- data/app/presenters/hyrax/version_list_presenter.rb +19 -0
- data/app/presenters/hyrax/version_presenter.rb +3 -2
- data/app/presenters/hyrax/work_show_presenter.rb +30 -5
- data/app/presenters/hyrax/work_usage.rb +5 -3
- data/app/renderers/hyrax/renderers/attribute_renderer.rb +10 -2
- data/app/search_builders/hyrax/admin_set_search_builder.rb +1 -1
- data/app/search_builders/hyrax/collection_member_search_builder.rb +6 -1
- data/app/search_builders/hyrax/my/collections_search_builder.rb +2 -2
- data/app/search_builders/hyrax/nested_collections_parent_search_builder.rb +1 -1
- data/app/search_builders/hyrax/single_collection_search_builder.rb +1 -1
- data/app/services/hyrax/access_control_list.rb +1 -1
- data/app/services/hyrax/adapters/nesting_index_adapter.rb +1 -1
- data/app/services/hyrax/admin_set_create_service.rb +3 -1
- data/app/services/hyrax/collections/collection_member_search_service.rb +72 -0
- data/app/services/hyrax/collections/collection_member_service.rb +112 -27
- data/app/services/hyrax/collections/migration_service.rb +4 -2
- data/app/services/hyrax/collections/nested_collection_persistence_service.rb +12 -13
- data/app/services/hyrax/collections/nested_collection_query_service.rb +2 -0
- data/app/services/hyrax/collections/permissions_create_service.rb +6 -4
- data/app/services/hyrax/contextual_path.rb +24 -1
- data/app/services/hyrax/custom_queries/find_file_metadata.rb +7 -5
- data/app/services/hyrax/custom_queries/navigators/parent_collections_navigator.rb +46 -0
- data/app/services/hyrax/edit_permissions_service.rb +74 -41
- data/app/services/hyrax/embargo_manager.rb +1 -1
- data/app/services/hyrax/find_objects_via_solr_service.rb +31 -0
- data/app/services/hyrax/graph_exporter.rb +1 -1
- data/app/services/hyrax/listeners/member_cleanup_listener.rb +26 -0
- data/app/services/hyrax/listeners/metadata_index_listener.rb +18 -1
- data/app/services/hyrax/listeners/object_lifecycle_listener.rb +1 -1
- data/app/services/hyrax/listeners/trophy_cleanup_listener.rb +17 -0
- data/app/services/hyrax/listeners.rb +2 -0
- data/app/services/hyrax/multiple_membership_checker.rb +53 -29
- data/app/services/hyrax/persist_derivatives.rb +3 -1
- data/app/services/hyrax/resource_status.rb +7 -0
- data/app/services/hyrax/search_service.rb +4 -2
- data/app/services/hyrax/solr_query_builder_service.rb +45 -8
- data/app/services/hyrax/solr_query_service.rb +224 -0
- data/app/services/hyrax/solr_service.rb +8 -1
- data/app/services/hyrax/statistics/depositors/summary.rb +2 -1
- data/app/services/hyrax/thumbnail_path_service.rb +1 -1
- data/app/services/hyrax/versioning_service.rb +1 -1
- data/app/services/hyrax/visibility_intention.rb +20 -2
- data/app/services/hyrax/visibility_propagator.rb +30 -1
- data/app/services/hyrax/work_uploads_handler.rb +22 -4
- data/app/services/hyrax/workflow/actionable_objects.rb +70 -0
- data/app/services/hyrax/workflow/object_in_workflow_decorator.rb +31 -0
- data/app/services/hyrax/workflow/status_list_service.rb +43 -13
- data/app/views/hyrax/admin/admin_sets/_show_document_list_row.html.erb +1 -1
- data/app/views/hyrax/base/_form_child_work_relationships.html.erb +1 -1
- data/app/views/hyrax/base/_form_relationships.html.erb +1 -2
- data/app/views/hyrax/base/_form_rendering.html.erb +1 -1
- data/app/views/hyrax/base/_form_representative.html.erb +1 -1
- data/app/views/hyrax/base/_form_share.html.erb +1 -5
- data/app/views/hyrax/base/_form_thumbnail.html.erb +1 -1
- data/app/views/hyrax/base/_form_visibility_error.html.erb +2 -0
- data/app/views/hyrax/base/_guts4form.html.erb +3 -3
- data/app/views/hyrax/base/_representative_media.html.erb +1 -1
- data/app/views/hyrax/base/_show_actions.html.erb +2 -2
- data/app/views/hyrax/base/_work_button_row.html.erb +1 -1
- data/app/views/hyrax/base/_workflow_actions.html.erb +1 -1
- data/app/views/hyrax/batch_edits/edit.html.erb +2 -2
- data/app/views/hyrax/batch_uploads/_form.html.erb +1 -1
- data/app/views/hyrax/collections/_list_collections.html.erb +1 -1
- data/app/views/hyrax/collections/_search_form.html.erb +1 -1
- data/app/views/hyrax/collections/show.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_form.html.erb +3 -3
- data/app/views/hyrax/dashboard/collections/_form_branding.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_list_collections.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/edit.html.erb +4 -2
- data/app/views/hyrax/dashboard/collections/new.html.erb +4 -2
- data/app/views/hyrax/dashboard/collections/show.html.erb +1 -1
- data/app/views/hyrax/file_sets/_actions.html.erb +10 -0
- data/app/views/hyrax/file_sets/edit.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_audio.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_default.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_image.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_office_document.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_pdf.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_video.html.erb +1 -1
- data/app/views/hyrax/file_sets/show.html.erb +1 -1
- data/app/views/hyrax/my/_admin_set_action_menu.html.erb +0 -11
- data/app/views/hyrax/my/_collection_action_menu.html.erb +1 -2
- data/app/views/hyrax/my/collections/_list_collections.html.erb +1 -1
- data/app/views/hyrax/my/collections/_modal_add_subcollection.html.erb +3 -5
- data/app/views/hyrax/stats/file.html.erb +1 -1
- data/app/views/hyrax/stats/work.html.erb +1 -1
- data/app/views/hyrax/uploads/_js_templates.html.erb +4 -4
- data/app/views/hyrax/uploads/_js_templates_versioning.html.erb +4 -4
- data/app/views/hyrax/users/_contributions.html.erb +1 -1
- data/app/views/hyrax/users/_profile_tabs.html.erb +2 -2
- data/app/views/hyrax/users/_search_form.html.erb +1 -1
- data/app/views/hyrax/users/_user.html.erb +1 -1
- data/app/views/hyrax/users/_user_info.html.erb +9 -9
- data/bin/db-migrate-seed.sh +6 -2
- data/bin/hyrax-entrypoint.sh +0 -14
- data/bin/solrcloud-assign-configset.sh +35 -0
- data/bin/solrcloud-upload-configset.sh +42 -0
- data/chart/hyrax/Chart.yaml +12 -8
- data/chart/hyrax/README.md +94 -11
- data/chart/hyrax/templates/NOTES.txt +1 -1
- data/chart/hyrax/templates/_helpers.tpl +98 -0
- data/chart/hyrax/templates/branding-pvc.yaml +14 -0
- data/chart/hyrax/templates/configmap-env.yaml +21 -11
- data/chart/hyrax/templates/cron-embargo.yaml +24 -0
- data/chart/hyrax/templates/cron-lease.yaml +24 -0
- data/chart/hyrax/templates/deployment-worker.yaml +129 -0
- data/chart/hyrax/templates/deployment.yaml +125 -4
- data/chart/hyrax/templates/derivatives-pvc.yaml +14 -0
- data/chart/hyrax/templates/ingress.yaml +13 -4
- data/chart/hyrax/templates/secrets.yaml +12 -2
- data/chart/hyrax/templates/uploads-pvc.yaml +14 -0
- data/chart/hyrax/values.yaml +186 -2
- data/config/brakeman.ignore +2 -2
- data/config/features.rb +47 -43
- data/config/initializers/listeners.rb +4 -0
- data/config/initializers/valkryrie_storage.rb +7 -0
- data/config/locales/hyrax.de.yml +1 -1
- data/config/locales/hyrax.en.yml +1 -1
- data/config/locales/hyrax.es.yml +1 -1
- data/config/locales/hyrax.fr.yml +1 -1
- data/config/locales/hyrax.it.yml +1 -1
- data/config/locales/hyrax.pt-BR.yml +1 -1
- data/config/locales/hyrax.zh.yml +1 -1
- data/docker-compose.yml +39 -8
- data/documentation/developing-your-hyrax-based-app.md +4 -4
- data/documentation/legacyREADME.md +3 -3
- data/lib/generators/hyrax/templates/config/initializers/hyrax.rb +5 -0
- data/lib/generators/hyrax/templates/config/initializers/riiif.rb +22 -20
- data/lib/hyrax/active_fedora_dummy_model.rb +62 -0
- data/lib/hyrax/configuration.rb +28 -0
- data/lib/hyrax/engine.rb +3 -1
- data/lib/hyrax/errors.rb +2 -0
- data/lib/hyrax/resource_name.rb +1 -0
- data/lib/hyrax/specs/capybara.rb +5 -3
- data/lib/hyrax/specs/shared_specs/valkyrie_storage_versions.rb +9 -0
- data/lib/hyrax/transactions/container.rb +32 -1
- data/lib/hyrax/transactions/file_set_destroy.rb +21 -0
- data/lib/hyrax/transactions/steps/add_file_sets.rb +3 -2
- data/lib/hyrax/transactions/steps/add_to_parent.rb +36 -0
- data/lib/hyrax/transactions/steps/delete_resource.rb +38 -0
- data/lib/hyrax/transactions/steps/destroy_work.rb +1 -0
- data/lib/hyrax/transactions/steps/remove_file_set_from_work.rb +47 -0
- data/lib/hyrax/transactions/work_create.rb +2 -1
- data/lib/hyrax/transactions/work_destroy.rb +20 -0
- data/lib/hyrax/valkyrie_can_can_adapter.rb +3 -0
- data/lib/hyrax/valkyrie_simple_path_generator.rb +20 -0
- data/lib/hyrax/version.rb +1 -1
- data/lib/hyrax.rb +9 -0
- data/lib/tasks/collection_type_global_id.rake +1 -1
- data/lib/tasks/embargo_lease.rake +27 -0
- data/lib/tasks/regenerate_derivatives.rake +12 -0
- data/lib/wings/active_fedora_converter/default_work.rb +19 -0
- data/lib/wings/attribute_transformer.rb +29 -19
- data/lib/wings/converter_value_mapper.rb +2 -2
- data/lib/wings/model_transformer.rb +21 -20
- data/lib/wings/orm_converter.rb +42 -23
- data/lib/wings/setup.rb +2 -0
- data/lib/wings/valkyrie/persister.rb +8 -5
- data/lib/wings/valkyrie/query_service.rb +96 -41
- data/lib/wings/valkyrie/storage.rb +56 -1
- data/lib/wings.rb +0 -21
- data/template.rb +1 -1
- metadata +41 -21
- data/chart/fcrepo/.gitignore +0 -2
- data/chart/fcrepo/.helmignore +0 -23
- data/chart/fcrepo/Chart.yaml +0 -11
- data/chart/fcrepo/README.md +0 -50
- data/chart/fcrepo/templates/NOTES.txt +0 -21
- data/chart/fcrepo/templates/_helpers.tpl +0 -68
- data/chart/fcrepo/templates/configmap-env.yaml +0 -19
- data/chart/fcrepo/templates/deployment.yaml +0 -109
- data/chart/fcrepo/templates/ingress.yaml +0 -41
- data/chart/fcrepo/templates/pvc.yaml +0 -20
- data/chart/fcrepo/templates/secret.yaml +0 -12
- data/chart/fcrepo/templates/service.yaml +0 -15
- data/chart/fcrepo/templates/serviceaccount.yaml +0 -12
- data/chart/fcrepo/templates/tests/test-connection.yaml +0 -15
- data/chart/fcrepo/values.yaml +0 -79
- data/chart/hyrax/templates/fcrepo-secret.yaml +0 -13
@@ -1,15 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
class EmbargoExpiryJob < Hyrax::ApplicationJob
|
3
3
|
def perform
|
4
|
-
records_with_expired_embargos.each do |
|
5
|
-
|
6
|
-
|
4
|
+
records_with_expired_embargos.each do |resource|
|
5
|
+
Hyrax::EmbargoManager.release_embargo_for(resource: resource) &&
|
6
|
+
Hyrax::AccessControlList(resource).save
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
10
|
##
|
11
|
-
# @return [Enumerator<
|
11
|
+
# @return [Enumerator<Valkyrie::Resource>] ids for all the objects that have expired active embargoes
|
12
12
|
def records_with_expired_embargos
|
13
|
-
Hyrax::EmbargoService.assets_with_expired_embargoes.map(&:id)
|
13
|
+
ids = Hyrax::EmbargoService.assets_with_expired_embargoes.map(&:id)
|
14
|
+
|
15
|
+
Hyrax.query_service.find_many_by_ids(ids: ids)
|
14
16
|
end
|
15
17
|
end
|
@@ -30,6 +30,11 @@ class FileSetAttachedEventJob < ContentEventJob
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def curation_concern
|
33
|
-
repo_object
|
33
|
+
case repo_object
|
34
|
+
when ActiveFedora::Base
|
35
|
+
repo_object.in_works.first
|
36
|
+
else
|
37
|
+
Hyrax.query_service.find_parents(resource: repo_object).first
|
38
|
+
end
|
34
39
|
end
|
35
40
|
end
|
@@ -2,13 +2,29 @@
|
|
2
2
|
class IngestLocalFileJob < Hyrax::ApplicationJob
|
3
3
|
queue_as Hyrax.config.ingest_queue_name
|
4
4
|
|
5
|
-
# @param [FileSet] file_set
|
5
|
+
# @param [FileSet, Hyrax::FileSet] file_set
|
6
6
|
# @param [String] path
|
7
7
|
# @param [User] user
|
8
8
|
def perform(file_set, path, user)
|
9
|
+
case file_set
|
10
|
+
when ActiveFedora::Base
|
11
|
+
__perform(file_set, path, user, use_valkyrie: false)
|
12
|
+
else
|
13
|
+
__perform(file_set, path, user, use_valkyrie: true)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
# @note Based on the present implementation (see SHA a8597884e) of
|
20
|
+
# the Hyrax::Actors::FileSetActor, we wouldn't need to pass the
|
21
|
+
# `use_valkyrie` parameter. However, I want to include this logic
|
22
|
+
# to demonstrate that "Yes, the IngestLocalFileJob has been tested
|
23
|
+
# for Valkyrie usage"
|
24
|
+
def __perform(file_set, path, user, use_valkyrie:)
|
9
25
|
file_set.label ||= File.basename(path)
|
10
26
|
|
11
|
-
actor = Hyrax::Actors::FileSetActor.new(file_set, user)
|
27
|
+
actor = Hyrax::Actors::FileSetActor.new(file_set, user, use_valkyrie: use_valkyrie)
|
12
28
|
|
13
29
|
if actor.create_content(File.open(path))
|
14
30
|
Hyrax.config.callback.run(:after_import_local_file_success, file_set, user, path, warn: false)
|
@@ -5,12 +5,16 @@ class InheritPermissionsJob < Hyrax::ApplicationJob
|
|
5
5
|
# Perform the copy from the work to the contained filesets
|
6
6
|
#
|
7
7
|
# @param work containing access level and filesets
|
8
|
-
# @param use_valkyrie [Boolean] whether to use valkyrie support
|
9
|
-
def perform(work, use_valkyrie:
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
# @param use_valkyrie [Boolean] whether to use valkyrie support (deprecated)
|
9
|
+
def perform(work, use_valkyrie: :DEFAULT)
|
10
|
+
Deprecation.warn("use_valkyrie argument is deprecated, behavior depends on deserialized resource") unless
|
11
|
+
use_valkyrie == :DEFAULT
|
12
|
+
|
13
|
+
case work
|
14
|
+
when ActiveFedora::Base
|
13
15
|
af_perform(work)
|
16
|
+
else
|
17
|
+
valkyrie_perform(work)
|
14
18
|
end
|
15
19
|
end
|
16
20
|
|
@@ -1,15 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
class LeaseExpiryJob < Hyrax::ApplicationJob
|
3
3
|
def perform
|
4
|
-
records_with_expired_leases.each do |
|
5
|
-
|
6
|
-
|
4
|
+
records_with_expired_leases.each do |resource|
|
5
|
+
Hyrax::LeaseManager.release_lease_for(resource: resource) &&
|
6
|
+
Hyrax::AccessControlList(resource).save
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
10
|
##
|
11
11
|
# @return [Enumerator<String>] ids for all the objects that have expired active leases
|
12
12
|
def records_with_expired_leases
|
13
|
-
Hyrax::LeaseService.assets_with_expired_leases.map(&:id)
|
13
|
+
ids = Hyrax::LeaseService.assets_with_expired_leases.map(&:id)
|
14
|
+
|
15
|
+
Hyrax.query_service.find_many_by_ids(ids: ids)
|
14
16
|
end
|
15
17
|
end
|
data/app/models/admin_set.rb
CHANGED
@@ -75,37 +75,18 @@ class AdminSet < ActiveFedora::Base
|
|
75
75
|
Sipity::Workflow.find_active_workflow_for(admin_set_id: id)
|
76
76
|
end
|
77
77
|
|
78
|
+
##
|
79
|
+
# @deprecated use PermissionTemplate#reset_access_controls instead
|
80
|
+
#
|
78
81
|
# Calculate and update who should have edit access based on who
|
79
82
|
# has "manage" access in the PermissionTemplateAccess
|
80
83
|
def reset_access_controls!
|
81
|
-
|
82
|
-
# See also app/models/concerns/hyrax/collection_behavior.rb#reset_access_controls!
|
83
|
-
update!(edit_users: permission_template_edit_users,
|
84
|
-
edit_groups: permission_template_edit_groups,
|
85
|
-
read_users: permission_template_read_users,
|
86
|
-
read_groups: permission_template_read_groups)
|
87
|
-
end
|
88
|
-
|
89
|
-
private
|
90
|
-
|
91
|
-
def permission_template_edit_users
|
92
|
-
permission_template.agent_ids_for(access: 'manage', agent_type: 'user')
|
93
|
-
end
|
94
|
-
|
95
|
-
def permission_template_edit_groups
|
96
|
-
permission_template.agent_ids_for(access: 'manage', agent_type: 'group')
|
97
|
-
end
|
84
|
+
Deprecation.warn("reset_access_controls! is deprecated; use PermissionTemplate#reset_access_controls instead.")
|
98
85
|
|
99
|
-
|
100
|
-
(permission_template.agent_ids_for(access: 'view', agent_type: 'user') +
|
101
|
-
permission_template.agent_ids_for(access: 'deposit', agent_type: 'user')).uniq
|
86
|
+
permission_template.reset_access_controls_for(collection: self)
|
102
87
|
end
|
103
88
|
|
104
|
-
|
105
|
-
(permission_template.agent_ids_for(access: 'view', agent_type: 'group') +
|
106
|
-
permission_template.agent_ids_for(access: 'deposit', agent_type: 'group')).uniq -
|
107
|
-
[::Ability.registered_group_name, ::Ability.public_group_name]
|
108
|
-
end
|
89
|
+
private
|
109
90
|
|
110
91
|
def destroy_permission_template
|
111
92
|
permission_template.destroy
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
class CollectionBrandingInfo < ApplicationRecord
|
3
|
-
# i = ColectionImageInfo.new()
|
4
|
-
|
5
3
|
def initialize(collection_id:,
|
6
4
|
filename:,
|
7
5
|
role:,
|
@@ -13,20 +11,32 @@ class CollectionBrandingInfo < ApplicationRecord
|
|
13
11
|
self.role = role
|
14
12
|
self.alt_text = alt_txt
|
15
13
|
self.target_url = target_url
|
16
|
-
|
17
|
-
self.local_path = find_local_filename(collection_id, role, filename)
|
14
|
+
self.local_path = File.join(role, filename)
|
18
15
|
end
|
19
16
|
|
20
17
|
def save(file_location, copy_file = true)
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
filename = File.split(local_path).last
|
19
|
+
role_and_filename = File.join(role, filename)
|
20
|
+
|
21
|
+
storage.upload(resource: Hyrax::PcdmCollection.new(id: collection_id),
|
22
|
+
file: File.open(file_location),
|
23
|
+
original_filename: role_and_filename)
|
24
|
+
self.local_path = find_local_filename(collection_id, role, filename)
|
25
|
+
|
24
26
|
FileUtils.remove_file(file_location) if File.exist?(file_location) && copy_file
|
25
27
|
super()
|
26
28
|
end
|
27
29
|
|
28
|
-
def delete(location_path)
|
29
|
-
|
30
|
+
def delete(location_path = nil)
|
31
|
+
id = if location_path
|
32
|
+
Deprecation.warn('Passing an explict location path is ' \
|
33
|
+
'deprecated. Call without arguments instead.')
|
34
|
+
location_path
|
35
|
+
else
|
36
|
+
local_path
|
37
|
+
end
|
38
|
+
|
39
|
+
storage.delete(id: id)
|
30
40
|
end
|
31
41
|
|
32
42
|
def find_local_filename(collection_id, role, filename)
|
@@ -37,4 +47,10 @@ class CollectionBrandingInfo < ApplicationRecord
|
|
37
47
|
def find_local_dir_name(collection_id, role)
|
38
48
|
File.join(Hyrax.config.branding_path, collection_id.to_s, role.to_s)
|
39
49
|
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def storage
|
54
|
+
Hyrax.config.branding_storage_adapter
|
55
|
+
end
|
40
56
|
end
|
@@ -37,6 +37,7 @@ module Hyrax
|
|
37
37
|
self.registered_group_name = Hyrax.config.registered_user_group_name
|
38
38
|
self.public_group_name = Hyrax.config.public_user_group_name
|
39
39
|
self.ability_logic += [:admin_permissions,
|
40
|
+
:edit_resources,
|
40
41
|
:curation_concerns_permissions,
|
41
42
|
:operation_abilities,
|
42
43
|
:add_to_collection,
|
@@ -108,6 +109,16 @@ module Hyrax
|
|
108
109
|
end
|
109
110
|
end
|
110
111
|
|
112
|
+
##
|
113
|
+
# @api public
|
114
|
+
#
|
115
|
+
# Allows
|
116
|
+
def edit_resources
|
117
|
+
can [:edit, :update, :destroy], Hyrax::Resource do |resource|
|
118
|
+
test_edit(resource.id)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
111
122
|
##
|
112
123
|
# @api public
|
113
124
|
#
|
@@ -406,8 +417,10 @@ module Hyrax
|
|
406
417
|
|
407
418
|
def extract_subjects(subject)
|
408
419
|
case subject
|
420
|
+
when Hyrax::WorkShowPresenter, FileSetPresenter, Hyrax::CollectionPresenter
|
421
|
+
extract_subjects(subject.solr_document)
|
409
422
|
when Draper::Decorator
|
410
|
-
|
423
|
+
extract_subjects(subject.model)
|
411
424
|
else
|
412
425
|
super
|
413
426
|
end
|
@@ -51,27 +51,22 @@ module Hyrax
|
|
51
51
|
end
|
52
52
|
|
53
53
|
# Add members using the members association.
|
54
|
-
# TODO: Confirm if this is ever used. I believe all relationships are done through
|
55
|
-
# add_member_objects using the member_of_collections relationship. Deprecate?
|
56
54
|
def add_members(new_member_ids)
|
57
|
-
|
58
|
-
|
55
|
+
Deprecation.warn("'##{__method__}' will be removed in Hyrax 4.0. " \
|
56
|
+
"Instead, use Hyrax::Collections::CollectionMemberService.add_members_by_ids.")
|
57
|
+
Hyrax::Collections::CollectionMemberService.add_members_by_ids(collection_id: id,
|
58
|
+
new_member_ids: new_member_ids,
|
59
|
+
user: nil)
|
59
60
|
end
|
60
61
|
|
61
62
|
# Add member objects by adding this collection to the objects' member_of_collection association.
|
62
63
|
# @param [Enumerable<String>] the ids of the new child collections and works collection ids
|
63
64
|
def add_member_objects(new_member_ids)
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
else
|
70
|
-
member.member_of_collections << self
|
71
|
-
member.save!
|
72
|
-
end
|
73
|
-
member
|
74
|
-
end
|
65
|
+
Deprecation.warn("'##{__method__}' will be removed in Hyrax 4.0. " \
|
66
|
+
"Instead, use Hyrax::Collections::CollectionMemberService.add_members_by_ids.")
|
67
|
+
Hyrax::Collections::CollectionMemberService.add_members_by_ids(collection_id: id,
|
68
|
+
new_member_ids: new_member_ids,
|
69
|
+
user: nil)
|
75
70
|
end
|
76
71
|
|
77
72
|
# @return [Enumerable<ActiveFedora::Base>] an enumerable over the children of this collection
|
@@ -125,41 +120,19 @@ module Hyrax
|
|
125
120
|
Hyrax::PermissionTemplate.find_by!(source_id: id)
|
126
121
|
end
|
127
122
|
|
123
|
+
##
|
124
|
+
# @deprecated use PermissionTemplate#reset_access_controls instead
|
125
|
+
#
|
128
126
|
# Calculate and update who should have read/edit access to the collections based on who
|
129
127
|
# has access in PermissionTemplateAccess
|
130
128
|
def reset_access_controls!
|
131
|
-
|
132
|
-
edit_groups: permission_template_edit_groups,
|
133
|
-
read_users: permission_template_read_users,
|
134
|
-
read_groups: (permission_template_read_groups + visibility_group).uniq)
|
135
|
-
end
|
136
|
-
|
137
|
-
private
|
138
|
-
|
139
|
-
def permission_template_edit_users
|
140
|
-
permission_template.agent_ids_for(access: 'manage', agent_type: 'user')
|
141
|
-
end
|
129
|
+
Deprecation.warn("reset_access_controls! is deprecated; use PermissionTemplate#reset_access_controls instead.")
|
142
130
|
|
143
|
-
|
144
|
-
|
131
|
+
permission_template
|
132
|
+
.reset_access_controls_for(collection: self, interpret_visibility: true)
|
145
133
|
end
|
146
134
|
|
147
|
-
|
148
|
-
(permission_template.agent_ids_for(access: 'view', agent_type: 'user') +
|
149
|
-
permission_template.agent_ids_for(access: 'deposit', agent_type: 'user')).uniq
|
150
|
-
end
|
151
|
-
|
152
|
-
def permission_template_read_groups
|
153
|
-
(permission_template.agent_ids_for(access: 'view', agent_type: 'group') +
|
154
|
-
permission_template.agent_ids_for(access: 'deposit', agent_type: 'group')).uniq -
|
155
|
-
[::Ability.registered_group_name, ::Ability.public_group_name]
|
156
|
-
end
|
157
|
-
|
158
|
-
def visibility_group
|
159
|
-
return [Hydra::AccessControls::AccessRight::PERMISSION_TEXT_VALUE_PUBLIC] if visibility == Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
|
160
|
-
return [Hydra::AccessControls::AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED] if visibility == Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED
|
161
|
-
[]
|
162
|
-
end
|
135
|
+
private
|
163
136
|
|
164
137
|
# Solr field name works use to index member ids
|
165
138
|
def member_ids_field
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Hyrax
|
3
|
+
module Embargoable
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
include Hydra::AccessControls::Embargoable
|
6
|
+
|
7
|
+
included do
|
8
|
+
validates :lease_expiration_date, 'hydra/future_date': true, on: :create
|
9
|
+
validates :embargo_release_date, 'hydra/future_date': true, on: :create
|
10
|
+
end
|
11
|
+
|
12
|
+
##
|
13
|
+
# Override aggressive Hydra::AccessControls validation
|
14
|
+
def enforce_future_date_for_embargo?
|
15
|
+
false
|
16
|
+
end
|
17
|
+
|
18
|
+
##
|
19
|
+
# Override aggressive Hydra::AccessControls validation
|
20
|
+
def enforce_future_date_for_lease?
|
21
|
+
false
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -1,18 +1,24 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# By default, the file holding the metadata is :original_file and the terms
|
4
|
-
# are listed under ::characterization_terms.
|
5
|
-
# Implementations may define their own terms or use a different source file, but
|
6
|
-
# any terms must be set on the ::characterization_proxy by the Hydra::Works::CharacterizationService
|
7
|
-
#
|
8
|
-
# class MyFileSet
|
9
|
-
# include Hyrax::FileSetBehavior
|
10
|
-
# end
|
11
|
-
#
|
12
|
-
# MyFileSet.characterization_proxy = :master_file
|
13
|
-
# MyFileSet.characterization_terms = [:term1, :term2, :term3]
|
2
|
+
|
14
3
|
module Hyrax
|
15
4
|
class FileSet
|
5
|
+
##
|
6
|
+
# This module points the FileSet to the location of the technical metadata.
|
7
|
+
# By default, the file holding the metadata is +:original_file+ and the terms
|
8
|
+
# are listed under +.characterization_terms+.
|
9
|
+
#
|
10
|
+
# Implementations may define their own terms or use a different source file, but
|
11
|
+
# any terms must be set on the +.characterization_proxy+ by the
|
12
|
+
# +Hydra::Works::CharacterizationService+.
|
13
|
+
#
|
14
|
+
# @example
|
15
|
+
# class MyFileSet
|
16
|
+
# include Hyrax::FileSetBehavior
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
# MyFileSet.characterization_proxy = :master_file
|
20
|
+
# MyFileSet.characterization_terms = [:term1, :term2, :term3]
|
21
|
+
#
|
16
22
|
module Characterization
|
17
23
|
extend ActiveSupport::Concern
|
18
24
|
|
@@ -13,6 +13,8 @@ module Hyrax
|
|
13
13
|
#
|
14
14
|
# @see https://github.com/projectblacklight/blacklight/wiki/Understanding-Rails-and-Blacklight#models
|
15
15
|
module SolrDocumentBehavior
|
16
|
+
ModelWrapper = ActiveFedoraDummyModel # alias for backward compatibility
|
17
|
+
|
16
18
|
extend ActiveSupport::Concern
|
17
19
|
include Hydra::Works::MimeTypes
|
18
20
|
include Hyrax::Permissions::Readable
|
@@ -39,58 +41,13 @@ module Hyrax
|
|
39
41
|
title_or_label.to_s
|
40
42
|
end
|
41
43
|
|
42
|
-
##
|
43
|
-
# Given a model class and an +id+, provides +ActiveModel+ style model methods.
|
44
|
-
#
|
45
|
-
# @note access this via {SolrDocumentBehavior#to_model}.
|
46
|
-
class ModelWrapper
|
47
|
-
##
|
48
|
-
# @api private
|
49
|
-
#
|
50
|
-
# @param [Class] model
|
51
|
-
# @param [String, nil] id
|
52
|
-
def initialize(model, id)
|
53
|
-
@model = model
|
54
|
-
@id = id
|
55
|
-
end
|
56
|
-
|
57
|
-
##
|
58
|
-
# @api public
|
59
|
-
def persisted?
|
60
|
-
true
|
61
|
-
end
|
62
|
-
|
63
|
-
##
|
64
|
-
# @api public
|
65
|
-
def to_param
|
66
|
-
@id
|
67
|
-
end
|
68
|
-
|
69
|
-
##
|
70
|
-
# @api public
|
71
|
-
def model_name
|
72
|
-
@model.model_name
|
73
|
-
end
|
74
|
-
|
75
|
-
##
|
76
|
-
# @api public
|
77
|
-
def to_partial_path
|
78
|
-
@model._to_partial_path
|
79
|
-
end
|
80
|
-
|
81
|
-
##
|
82
|
-
# @api public
|
83
|
-
def to_global_id
|
84
|
-
URI::GID.build app: GlobalID.app, model_name: model_name.name, model_id: @id
|
85
|
-
end
|
86
|
-
end
|
87
44
|
##
|
88
45
|
# Offer the source model to Rails for some of the Rails methods (e.g. link_to).
|
89
46
|
#
|
90
47
|
# @example
|
91
48
|
# link_to '...', SolrDocument(:id => 'bXXXXXX5').new => <a href="/dams_object/bXXXXXX5">...</a>
|
92
49
|
def to_model
|
93
|
-
@model ||=
|
50
|
+
@model ||= ActiveFedoraDummyModel.new(hydra_model, id)
|
94
51
|
end
|
95
52
|
|
96
53
|
##
|
@@ -111,6 +68,12 @@ module Hyrax
|
|
111
68
|
hydra_model == ::AdminSet
|
112
69
|
end
|
113
70
|
|
71
|
+
##
|
72
|
+
# @return [Boolean]
|
73
|
+
def work?
|
74
|
+
Hyrax.config.curation_concerns.include? hydra_model
|
75
|
+
end
|
76
|
+
|
114
77
|
# Method to return the model
|
115
78
|
def hydra_model(classifier: ActiveFedora.model_mapper)
|
116
79
|
"::#{first('has_model_ssim')}".safe_constantize ||
|