curation_concerns 0.1.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 +7 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/.travis.yml +18 -0
- data/Gemfile +31 -0
- data/LICENSE.txt +15 -0
- data/README.md +46 -0
- data/RELEASING.md +2 -0
- data/Rakefile +26 -0
- data/VERSION +1 -0
- data/app/assets/images/default.png +0 -0
- data/app/assets/images/nope.png +0 -0
- data/app/assets/javascripts/.gitkeep +0 -0
- data/app/assets/javascripts/curation_concerns/.gitkeep +0 -0
- data/app/assets/javascripts/curation_concerns/application.js +18 -0
- data/app/assets/javascripts/curation_concerns/browse_everything_implement.js +7 -0
- data/app/assets/javascripts/curation_concerns/curation_concerns.js +28 -0
- data/app/assets/javascripts/curation_concerns/embargoes.js +17 -0
- data/app/assets/javascripts/curation_concerns/facet_mine.js +22 -0
- data/app/assets/javascripts/curation_concerns/help_modal.js +36 -0
- data/app/assets/javascripts/curation_concerns/link_groups.js.coffee +123 -0
- data/app/assets/javascripts/curation_concerns/link_users.js.coffee +126 -0
- data/app/assets/javascripts/curation_concerns/proxy_rights.js.coffee +95 -0
- data/app/assets/javascripts/curation_concerns/proxy_submission.js +23 -0
- data/app/assets/javascripts/curation_concerns/select_works.js.coffee +20 -0
- data/app/assets/javascripts/modernizr.js +3 -0
- data/app/assets/stylesheets/curation_concerns/_curation_concerns.scss +9 -0
- data/app/assets/stylesheets/curation_concerns/_global-variables.scss +5 -0
- data/app/assets/stylesheets/curation_concerns/_modules.scss +13 -0
- data/app/assets/stylesheets/curation_concerns/_positioning.scss +138 -0
- data/app/assets/stylesheets/curation_concerns/_theme.scss +46 -0
- data/app/assets/stylesheets/curation_concerns/_typography.scss +137 -0
- data/app/assets/stylesheets/curation_concerns/_variables_bootstrap.scss +7 -0
- data/app/assets/stylesheets/curation_concerns/downloads.scss +3 -0
- data/app/assets/stylesheets/curation_concerns/help_requests.scss +3 -0
- data/app/assets/stylesheets/curation_concerns/modules/accessibility.scss +50 -0
- data/app/assets/stylesheets/curation_concerns/modules/accordion.scss +33 -0
- data/app/assets/stylesheets/curation_concerns/modules/attributes.scss +31 -0
- data/app/assets/stylesheets/curation_concerns/modules/classify_work.scss +100 -0
- data/app/assets/stylesheets/curation_concerns/modules/embargoes.scss +15 -0
- data/app/assets/stylesheets/curation_concerns/modules/emphatic_action_area.scss +14 -0
- data/app/assets/stylesheets/curation_concerns/modules/forms.scss +116 -0
- data/app/assets/stylesheets/curation_concerns/modules/multi_value_fields.scss +52 -0
- data/app/assets/stylesheets/curation_concerns/modules/pagination.scss +4 -0
- data/app/assets/stylesheets/curation_concerns/modules/search_results.scss +55 -0
- data/app/assets/stylesheets/curation_concerns/modules/site_actions.scss +53 -0
- data/app/assets/stylesheets/curation_concerns/modules/site_search.scss +46 -0
- data/app/controllers/catalog_controller.rb +3 -0
- data/app/controllers/collections_controller.rb +3 -0
- data/app/controllers/concerns/curation_concerns/application_controller_behavior.rb +28 -0
- data/app/controllers/concerns/curation_concerns/catalog_controller.rb +321 -0
- data/app/controllers/concerns/curation_concerns/collections_controller_behavior.rb +76 -0
- data/app/controllers/concerns/curation_concerns/curation_concern_controller.rb +125 -0
- data/app/controllers/concerns/curation_concerns/download_behavior.rb +60 -0
- data/app/controllers/concerns/curation_concerns/embargoes_controller_behavior.rb +44 -0
- data/app/controllers/concerns/curation_concerns/generic_files_controller_behavior.rb +149 -0
- data/app/controllers/concerns/curation_concerns/leases_controller_behavior.rb +36 -0
- data/app/controllers/concerns/curation_concerns/manages_embargoes.rb +26 -0
- data/app/controllers/concerns/curation_concerns/parent_container.rb +33 -0
- data/app/controllers/concerns/curation_concerns/themed_layout_controller.rb +31 -0
- data/app/controllers/concerns/curation_concerns/without_namespace.rb +15 -0
- data/app/controllers/curation_concerns/application_controller.rb +7 -0
- data/app/controllers/curation_concerns/classify_concerns_controller.rb +35 -0
- data/app/controllers/curation_concerns/generic_files_controller.rb +13 -0
- data/app/controllers/curation_concerns/permissions_controller.rb +19 -0
- data/app/controllers/downloads_controller.rb +4 -0
- data/app/controllers/embargoes_controller.rb +5 -0
- data/app/controllers/leases_controller.rb +5 -0
- data/app/controllers/registrations_controller.rb +20 -0
- data/app/controllers/sessions_controller.rb +4 -0
- data/app/datastreams/curation_concerns/generic_work_rdf_properties.rb +57 -0
- data/app/datastreams/generic_work_metadata.rb +3 -0
- data/app/forms/curation_concerns/forms/collection_edit_form.rb +17 -0
- data/app/forms/curation_concerns/forms/generic_file_edit_form.rb +15 -0
- data/app/forms/curation_concerns/forms/generic_work_edit_form.rb +9 -0
- data/app/helpers/curation_concerns/ability_helper.rb +46 -0
- data/app/helpers/curation_concerns/attribute_helper.rb +67 -0
- data/app/helpers/curation_concerns/catalog_helper.rb +38 -0
- data/app/helpers/curation_concerns/collections_helper.rb +63 -0
- data/app/helpers/curation_concerns/embargo_helper.rb +17 -0
- data/app/helpers/curation_concerns/generic_file_helper.rb +19 -0
- data/app/helpers/curation_concerns/lease_helper.rb +18 -0
- data/app/helpers/curation_concerns/main_app_helpers.rb +13 -0
- data/app/helpers/curation_concerns/render_constraints_helper.rb +42 -0
- data/app/helpers/curation_concerns/search_paths_helper.rb +13 -0
- data/app/helpers/curation_concerns/thumbnail_helper.rb +11 -0
- data/app/helpers/curation_concerns/title_helper.rb +23 -0
- data/app/helpers/curation_concerns/url_helper.rb +29 -0
- data/app/presenters/curation_concerns/collection_presenter.rb +40 -0
- data/app/presenters/curation_concerns/generic_file_presenter.rb +14 -0
- data/app/presenters/curation_concerns/generic_work_presenter.rb +13 -0
- data/app/search_builders/curation_concerns/search_builder.rb +49 -0
- data/app/services/curation_concerns/curation_concern.rb +14 -0
- data/app/services/curation_concerns/embargo_service.rb +26 -0
- data/app/services/curation_concerns/lease_service.rb +23 -0
- data/app/views/catalog/_action_menu_partials/_collection.html.erb +27 -0
- data/app/views/catalog/_action_menu_partials/_default.html.erb +27 -0
- data/app/views/catalog/_document.html.erb +3 -0
- data/app/views/catalog/_document_list.html.erb +5 -0
- data/app/views/catalog/_home_text.html.erb +8 -0
- data/app/views/catalog/_index_default.html.erb +17 -0
- data/app/views/catalog/_index_header_list_default.html.erb +8 -0
- data/app/views/catalog/_navbar.html.erb +12 -0
- data/app/views/catalog/_show_partials/_default.html.erb +22 -0
- data/app/views/catalog/_show_partials/_default_details.html.erb +15 -0
- data/app/views/catalog/_show_partials/_facets.html.erb +52 -0
- data/app/views/catalog/index.html.erb +47 -0
- data/app/views/collections/_add_to_collection_modal.html.erb +15 -0
- data/app/views/collections/_batch_edits_actions.html.erb +3 -0
- data/app/views/collections/_button_for_creating_empty_collection.html.erb +3 -0
- data/app/views/collections/_collection.html.erb +1 -0
- data/app/views/collections/_dashboard_document_list.html.erb +6 -0
- data/app/views/collections/_document_list.html.erb +7 -0
- data/app/views/collections/_edit_actions.html.erb +5 -0
- data/app/views/collections/_edit_descriptions.html.erb +20 -0
- data/app/views/collections/_form.html.erb +26 -0
- data/app/views/collections/_form_additional_information.html.erb +6 -0
- data/app/views/collections/_form_for_select_collection.html.erb +34 -0
- data/app/views/collections/_form_permission.html.erb +36 -0
- data/app/views/collections/_form_representative_image.html.erb +13 -0
- data/app/views/collections/_form_required_information.html.erb +11 -0
- data/app/views/collections/_form_to_add_member.html.erb +21 -0
- data/app/views/collections/_identifier_and_action.html.erb +15 -0
- data/app/views/collections/_media_display.html.erb +1 -0
- data/app/views/collections/_paginate.html.erb +6 -0
- data/app/views/collections/_search_collection_dashboard_form.html.erb +10 -0
- data/app/views/collections/_show_actions.html.erb +8 -0
- data/app/views/collections/_show_descriptions.html.erb +10 -0
- data/app/views/collections/_show_fields.html.erb +0 -0
- data/app/views/collections/_single_item_action_fields.html.erb +6 -0
- data/app/views/collections/_sort_and_per_page.html.erb +29 -0
- data/app/views/collections/_view_type_group.html.erb +13 -0
- data/app/views/collections/edit.html.erb +17 -0
- data/app/views/collections/show.html.erb +24 -0
- data/app/views/curation_concerns/base/_attributes.html.erb +25 -0
- data/app/views/curation_concerns/base/_collections.html.erb +26 -0
- data/app/views/curation_concerns/base/_form.html.erb +25 -0
- data/app/views/curation_concerns/base/_form_additional_information.html.erb +7 -0
- data/app/views/curation_concerns/base/_form_content_license.html.erb +16 -0
- data/app/views/curation_concerns/base/_form_descriptive_fields.erb +11 -0
- data/app/views/curation_concerns/base/_form_editors.html.erb +15 -0
- data/app/views/curation_concerns/base/_form_files_and_links.html.erb +23 -0
- data/app/views/curation_concerns/base/_form_permission.html.erb +52 -0
- data/app/views/curation_concerns/base/_form_permission_embargo.html.erb +6 -0
- data/app/views/curation_concerns/base/_form_permission_lease.html.erb +6 -0
- data/app/views/curation_concerns/base/_form_permission_under_embargo.html.erb +16 -0
- data/app/views/curation_concerns/base/_form_permission_under_lease.html.erb +18 -0
- data/app/views/curation_concerns/base/_form_representative_image.html.erb +13 -0
- data/app/views/curation_concerns/base/_form_required_information.html.erb +11 -0
- data/app/views/curation_concerns/base/_form_supplementary_fields.html.erb +15 -0
- data/app/views/curation_concerns/base/_legally_binding_text.html.erb +33 -0
- data/app/views/curation_concerns/base/_related_files.html.erb +24 -0
- data/app/views/curation_concerns/base/_representative_media.html.erb +8 -0
- data/app/views/curation_concerns/base/edit.html.erb +13 -0
- data/app/views/curation_concerns/base/new.html.erb +12 -0
- data/app/views/curation_concerns/base/show.html.erb +21 -0
- data/app/views/curation_concerns/base/unauthorized.html.erb +3 -0
- data/app/views/curation_concerns/classify_concerns/new.html.erb +25 -0
- data/app/views/curation_concerns/collections/_form_additional_information.html.erb +6 -0
- data/app/views/curation_concerns/generic_files/_actions.html.erb +16 -0
- data/app/views/curation_concerns/generic_files/_form.html.erb +35 -0
- data/app/views/curation_concerns/generic_files/_generic_file.html.erb +12 -0
- data/app/views/curation_concerns/generic_files/_media_display.html.erb +19 -0
- data/app/views/curation_concerns/generic_files/edit.html.erb +5 -0
- data/app/views/curation_concerns/generic_files/jq_upload.json.jbuilder +8 -0
- data/app/views/curation_concerns/generic_files/show.html.erb +15 -0
- data/app/views/curation_concerns/permissions/confirm.html.erb +21 -0
- data/app/views/embargoes/_embargo_history.html.erb +7 -0
- data/app/views/embargoes/_list_active_embargoes.html.erb +16 -0
- data/app/views/embargoes/_list_deactivated_embargoes.html.erb +10 -0
- data/app/views/embargoes/_list_expired_active_embargoes.html.erb +44 -0
- data/app/views/embargoes/edit.html.erb +43 -0
- data/app/views/embargoes/index.html.erb +18 -0
- data/app/views/layouts/boilerplate.html.erb +22 -0
- data/app/views/layouts/curation_concerns/1_column.html.erb +11 -0
- data/app/views/layouts/curation_concerns/catalog.html.erb +37 -0
- data/app/views/layouts/curation_concerns.html.erb +22 -0
- data/app/views/leases/_lease_history.html.erb +7 -0
- data/app/views/leases/_list_active_leases.html.erb +16 -0
- data/app/views/leases/_list_deactivated_leases.html.erb +4 -0
- data/app/views/leases/_list_expired_active_leases.html.erb +38 -0
- data/app/views/leases/edit.html.erb +43 -0
- data/app/views/leases/index.html.erb +18 -0
- data/app/views/shared/_add_content.html.erb +32 -0
- data/app/views/shared/_brand_bar.html.erb +10 -0
- data/app/views/shared/_flash_message.html.erb +17 -0
- data/app/views/shared/_footer.html.erb +10 -0
- data/app/views/shared/_ga.html.erb +6 -0
- data/app/views/shared/_header.html.erb +12 -0
- data/app/views/shared/_my_actions.html.erb +21 -0
- data/app/views/shared/_site_actions.html.erb +7 -0
- data/app/views/shared/_site_search.html.erb +12 -0
- data/app/views/shared/_title_bar.html.erb +16 -0
- data/app/workers/visibility_copy_worker.rb +30 -0
- data/config/initializers/simple_form.rb +31 -0
- data/config/locales/curation_concerns.en.yml +96 -0
- data/config/routes.rb +4 -0
- data/curation_concerns-models/.gitignore +17 -0
- data/curation_concerns-models/Gemfile +4 -0
- data/curation_concerns-models/LICENSE.md +177 -0
- data/curation_concerns-models/README.md +42 -0
- data/curation_concerns-models/Rakefile +1 -0
- data/curation_concerns-models/app/actors/concerns/curation_concerns/manages_embargoes_actor.rb +99 -0
- data/curation_concerns-models/app/actors/curation_concerns/base_actor.rb +90 -0
- data/curation_concerns-models/app/actors/curation_concerns/generic_file_actor.rb +150 -0
- data/curation_concerns-models/app/actors/curation_concerns/work_actor_behavior.rb +88 -0
- data/curation_concerns-models/app/jobs/active_fedora_id_based_job.rb +22 -0
- data/curation_concerns-models/app/jobs/active_fedora_pid_based_job.rb +6 -0
- data/curation_concerns-models/app/jobs/audit_job.rb +58 -0
- data/curation_concerns-models/app/jobs/characterize_job.rb +11 -0
- data/curation_concerns-models/app/jobs/copy_permissions_job.rb +24 -0
- data/curation_concerns-models/app/jobs/create_derivatives_job.rb +15 -0
- data/curation_concerns-models/app/jobs/import_url_job.rb +56 -0
- data/curation_concerns-models/app/jobs/ingest_local_file_job.rb +48 -0
- data/curation_concerns-models/app/jobs/resolrize_job.rb +9 -0
- data/curation_concerns-models/app/models/checksum_audit_log.rb +21 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/ability.rb +34 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/basic_metadata.rb +87 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/collection_behavior.rb +47 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/belongs_to_works.rb +53 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/characterization.rb +89 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/content.rb +8 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/export.rb +343 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/full_text_indexing.rb +12 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/indexing.rb +14 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/versions.rb +16 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file.rb +5 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file_behavior.rb +44 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_work_behavior.rb +38 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/has_representative.rb +14 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/human_readable_type.rb +23 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/permissions/readable.rb +19 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/permissions/writable.rb +75 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/permissions.rb +7 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/serializers.rb +15 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/solr_document_behavior.rb +135 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/user.rb +65 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/with_basic_metadata.rb +98 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/with_generic_files.rb +29 -0
- data/curation_concerns-models/app/models/curation_concerns/classify_concern.rb +47 -0
- data/curation_concerns-models/app/models/curation_concerns/quick_classification_query.rb +31 -0
- data/curation_concerns-models/app/models/datastreams/fits_datastream.rb +148 -0
- data/curation_concerns-models/app/models/version_committer.rb +2 -0
- data/curation_concerns-models/app/services/curation_concerns/characterization_service.rb +71 -0
- data/curation_concerns-models/app/services/curation_concerns/full_text_extraction_service.rb +38 -0
- data/curation_concerns-models/app/services/curation_concerns/generic_file_audit_service.rb +85 -0
- data/curation_concerns-models/app/services/curation_concerns/generic_file_indexing_service.rb +14 -0
- data/curation_concerns-models/app/services/curation_concerns/generic_work_indexing_service.rb +16 -0
- data/curation_concerns-models/app/services/curation_concerns/noid.rb +23 -0
- data/curation_concerns-models/app/services/curation_concerns/repository_audit_service.rb +9 -0
- data/curation_concerns-models/app/services/curation_concerns/versioning_service.rb +27 -0
- data/curation_concerns-models/config/locales/curation_concerns.en.yml +6 -0
- data/curation_concerns-models/curation_concerns-models.gemspec +34 -0
- data/curation_concerns-models/lib/curation_concerns/messages.rb +66 -0
- data/curation_concerns-models/lib/curation_concerns/models/engine.rb +61 -0
- data/curation_concerns-models/lib/curation_concerns/models/resque.rb +36 -0
- data/curation_concerns-models/lib/curation_concerns/models/utils.rb +22 -0
- data/curation_concerns-models/lib/curation_concerns/models/version.rb +5 -0
- data/curation_concerns-models/lib/curation_concerns/models.rb +32 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/abstract_migration_generator.rb +30 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/clamav_generator.rb +19 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/fulltext_generator.rb +28 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/install_generator.rb +70 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/app/models/collection.rb +4 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/app/models/generic_file.rb +4 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/clamav.rb +1 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/curation_concerns.rb +123 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/mime_types.rb +6 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/redis.yml +9 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/redis_config.rb +32 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/resque-pool.yml +1 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/resque_admin.rb +10 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/resque_config.rb +5 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/migrations/create_checksum_audit_logs.rb +19 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/migrations/create_version_committers.rb +15 -0
- data/curation_concerns-models/lib/tasks/curation_concerns-models_tasks.rake +75 -0
- data/curation_concerns-models/lib/tasks/migrate.rake +13 -0
- data/curation_concerns-models/lib/tasks/resque.rake +13 -0
- data/curation_concerns-models/lib/tasks/solr_reindex.rake +8 -0
- data/curation_concerns.gemspec +46 -0
- data/lib/curation_concerns/configuration.rb +74 -0
- data/lib/curation_concerns/controller_resource.rb +10 -0
- data/lib/curation_concerns/engine.rb +20 -0
- data/lib/curation_concerns/rails/routes.rb +76 -0
- data/lib/curation_concerns/spec_support.rb +10 -0
- data/lib/curation_concerns/version.rb +3 -0
- data/lib/curation_concerns.rb +8 -0
- data/lib/generators/curation_concerns/install_generator.rb +103 -0
- data/lib/generators/curation_concerns/templates/curation_concerns.css.scss +3 -0
- data/lib/generators/curation_concerns/templates/curation_concerns.js +1 -0
- data/lib/generators/curation_concerns/templates/curation_concerns_config.rb +2 -0
- data/lib/generators/curation_concerns/templates/curation_concerns_helper.rb +4 -0
- data/lib/generators/curation_concerns/work/USAGE +19 -0
- data/lib/generators/curation_concerns/work/templates/README +13 -0
- data/lib/generators/curation_concerns/work/templates/actor.rb.erb +7 -0
- data/lib/generators/curation_concerns/work/templates/actor_spec.rb.erb +9 -0
- data/lib/generators/curation_concerns/work/templates/controller.rb.erb +7 -0
- data/lib/generators/curation_concerns/work/templates/controller_spec.rb.erb +9 -0
- data/lib/generators/curation_concerns/work/templates/model.rb.erb +7 -0
- data/lib/generators/curation_concerns/work/templates/model_spec.rb.erb +9 -0
- data/lib/generators/curation_concerns/work/work_generator.rb +78 -0
- data/solr_conf/conf/solrconfig.xml +223 -0
- data/spec/abilities/collection_abilities_spec.rb +48 -0
- data/spec/abilities/generic_file_abilities_spec.rb +62 -0
- data/spec/abilities/generic_work_abilities_spec.rb +58 -0
- data/spec/actors/curation_concerns/generic_file_actor_spec.rb +116 -0
- data/spec/actors/curation_concerns/manages_embargoes_actor_spec.rb +95 -0
- data/spec/actors/curation_concerns/work_actor_spec.rb +203 -0
- data/spec/controllers/catalog_controller_spec.rb +115 -0
- data/spec/controllers/curation_concerns/classify_concerns_controller_spec.rb +43 -0
- data/spec/controllers/curation_concerns/collections_controller_spec.rb +171 -0
- data/spec/controllers/curation_concerns/generic_files_controller_spec.rb +251 -0
- data/spec/controllers/curation_concerns/generic_works_controller_spec.rb +167 -0
- data/spec/controllers/curation_concerns/permissions_controller_spec.rb +29 -0
- data/spec/controllers/downloads_controller_spec.rb +51 -0
- data/spec/controllers/embargoes_controller_spec.rb +114 -0
- data/spec/controllers/leases_controller_spec.rb +94 -0
- data/spec/factories/collections.rb +15 -0
- data/spec/factories/create_curation_concern.rb +3 -0
- data/spec/factories/generic_files.rb +31 -0
- data/spec/factories/generic_works.rb +54 -0
- data/spec/factories/users.rb +28 -0
- data/spec/features/add_file_spec.rb +30 -0
- data/spec/features/collection_spec.rb +222 -0
- data/spec/features/create_work_spec.rb +43 -0
- data/spec/features/embargo_spec.rb +51 -0
- data/spec/features/lease_spec.rb +49 -0
- data/spec/features/update_file_spec.rb +32 -0
- data/spec/features/work_generator_spec.rb +58 -0
- data/spec/fixtures/Example.ogg +0 -0
- data/spec/fixtures/charter.docx +0 -0
- data/spec/fixtures/countdown.avi +0 -0
- data/spec/fixtures/curation_concerns_generic_stub.txt +1 -0
- data/spec/fixtures/files/image.png +0 -0
- data/spec/fixtures/image.jp2 +0 -0
- data/spec/fixtures/image.jpg +0 -0
- data/spec/fixtures/piano_note.wav +0 -0
- data/spec/fixtures/sample_mpeg4.mp4 +0 -0
- data/spec/fixtures/small_file.txt +1 -0
- data/spec/fixtures/spoken-text.m4a +0 -0
- data/spec/fixtures/test4.pdf +0 -0
- data/spec/fixtures/test5.mp3 +0 -0
- data/spec/fixtures/world.png +0 -0
- data/spec/forms/collection_edit_form_spec.rb +20 -0
- data/spec/forms/generic_file_edit_form_spec.rb +33 -0
- data/spec/helpers/catalog_helper_spec.rb +58 -0
- data/spec/helpers/configuration_helper_spec.rb +13 -0
- data/spec/helpers/curation_concerns/.keep +0 -0
- data/spec/helpers/curation_concerns/collections_helper_spec.rb +49 -0
- data/spec/helpers/render_constraints_helper_spec.rb +19 -0
- data/spec/helpers/thumbnail_helper_spec.rb +21 -0
- data/spec/helpers/url_helper_spec.rb +22 -0
- data/spec/jobs/active_fedora_id_based_job_spec.rb +14 -0
- data/spec/jobs/audit_job_spec.rb +53 -0
- data/spec/jobs/characterize_job_spec.rb +23 -0
- data/spec/jobs/copy_permissions_job_spec.rb +49 -0
- data/spec/jobs/create_derivatives_job_spec.rb +23 -0
- data/spec/jobs/curation_concerns_resque_queue_spec.rb +49 -0
- data/spec/jobs/import_url_job_spec.rb +45 -0
- data/spec/jobs/ingest_local_file_job_spec.rb +25 -0
- data/spec/lib/curation_concerns/messages_spec.rb +70 -0
- data/spec/lib/curation_concerns/readable_permissions_spec.rb +56 -0
- data/spec/lib/curation_concerns/writable_permissions_spec.rb +16 -0
- data/spec/matchers/metadata_field_matchers.rb +28 -0
- data/spec/matchers/response_matchers.rb +7 -0
- data/spec/matchers.rb +24 -0
- data/spec/models/checksum_audit_log_spec.rb +66 -0
- data/spec/models/curation_concerns/collection_behavior_spec.rb +107 -0
- data/spec/models/curation_concerns/generic_file/derivatives_spec.rb +88 -0
- data/spec/models/curation_concerns/generic_work_behavior_spec.rb +35 -0
- data/spec/models/fits_datastream_spec.rb +127 -0
- data/spec/models/generic_file_spec.rb +619 -0
- data/spec/models/generic_work_spec.rb +43 -0
- data/spec/models/user_spec.rb +23 -0
- data/spec/presenters/curation_concerns/collection_presenter_spec.rb +34 -0
- data/spec/presenters/curation_concerns/generic_file_presenter_spec.rb +16 -0
- data/spec/routing/curation_concerns/routes_spec.rb +36 -0
- data/spec/routing/route_spec.rb +86 -0
- data/spec/services/characterization_service_spec.rb +30 -0
- data/spec/services/embargo_service_spec.rb +38 -0
- data/spec/services/full_text_extraction_service_spec.rb +5 -0
- data/spec/services/generic_file_audit_service_spec.rb +71 -0
- data/spec/services/generic_file_indexing_service_spec.rb +57 -0
- data/spec/services/generic_work_indexing_service_spec.rb +18 -0
- data/spec/services/lease_service_spec.rb +53 -0
- data/spec/services/repository_audit_service_spec.rb +18 -0
- data/spec/services/versioning_service_spec.rb +32 -0
- data/spec/spec_helper.rb +94 -0
- data/spec/support/controllers/engine_helpers.rb +7 -0
- data/spec/support/curation_concerns/factory_helpers.rb +14 -0
- data/spec/support/features/fixture_file_upload.rb +14 -0
- data/spec/support/features/session_helpers.rb +41 -0
- data/spec/support/features.rb +19 -0
- data/spec/support/shared/shared_examples_has_dc_metadata.rb +17 -0
- data/spec/support/shared/shared_examples_is_embargoable.rb +8 -0
- data/spec/support/shared/shared_examples_with_access_rights.rb +63 -0
- data/spec/tasks/rake_spec.rb +24 -0
- data/spec/test_app_templates/Gemfile.extra +1 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +55 -0
- data/spec/views/catalog/index.html.erb_spec.rb +59 -0
- data/spec/views/curation_concerns/base/_attributes.html.erb_spec.rb +25 -0
- data/spec/views/curation_concerns/base/show.html.erb_spec.rb +29 -0
- data/spec/views/curation_concerns/permissions/confirm.html.erb_spec.rb +33 -0
- data/spec/views/shared/_add_content.html.erb_spec.rb +42 -0
- data/spec/views/shared/_my_actions.html.erb_spec.rb +23 -0
- data/spec/workers/visibility_copy_worker_spec.rb +70 -0
- data/tasks/jetty.rake +15 -0
- data/tasks/release.rake +93 -0
- data/vendor/assets/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/vendor/assets/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/vendor/assets/javascripts/handlebars.js +2278 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.autocomplete.js +602 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.core.js +356 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.effect-highlight.js +50 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.effect.js +1276 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.menu.js +610 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.position.js +498 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.widget.js +528 -0
- data/vendor/assets/javascripts/jquery.tokeninput.js +1061 -0
- data/vendor/assets/stylesheets/jquery-ui-lightness.css +474 -0
- data/vendor/assets/stylesheets/token-input-facebook.css +122 -0
- data/vendor/assets/stylesheets/token-input-mac.css +204 -0
- data/vendor/assets/stylesheets/token-input.css +127 -0
- metadata +888 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
module CurationConcerns
|
|
2
|
+
# Actions are decoupled from controller logic so that they may be called from a controller or a background job.
|
|
3
|
+
class GenericFileActor
|
|
4
|
+
include CurationConcerns::ManagesEmbargoesActor
|
|
5
|
+
|
|
6
|
+
attr_reader :generic_file, :user, :attributes, :curation_concern
|
|
7
|
+
|
|
8
|
+
def initialize(generic_file, user)
|
|
9
|
+
# we're setting attributes and curation_concern to bridge the difference
|
|
10
|
+
# between CurationConcerns::GenericFileActor and ManagesEmbargoesActor
|
|
11
|
+
@curation_concern = generic_file
|
|
12
|
+
@generic_file = generic_file
|
|
13
|
+
@user = user
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Adds the appropriate metadata, visibility and relationships to generic_file
|
|
17
|
+
#
|
|
18
|
+
# *Note*: In past versions of Sufia this method did not perform a save because it is mainly used in conjunction with
|
|
19
|
+
# create_content, which also performs a save. However, due to the relationship between Hydra::PCDM objects,
|
|
20
|
+
# we have to save both the parent work and the generic_file in order to record the "metadata" relationship
|
|
21
|
+
# between them.
|
|
22
|
+
# @param [String] batch_id id of the batch that the file was uploaded within
|
|
23
|
+
# @param [String] work_id id of the parent work that will contain the generic_file.
|
|
24
|
+
# @param [Hash] generic_file_params specifying the visibility, lease and/or embargo of the generic file. If you don't provide at least one of visibility, embargo_release_date or lease_expiration_date, visibility will be copied from the parent.
|
|
25
|
+
|
|
26
|
+
def create_metadata(batch_id, work_id, generic_file_params={})
|
|
27
|
+
generic_file.apply_depositor_metadata(user)
|
|
28
|
+
time_in_utc = DateTime.now.new_offset(0)
|
|
29
|
+
generic_file.date_uploaded = time_in_utc
|
|
30
|
+
generic_file.date_modified = time_in_utc
|
|
31
|
+
generic_file.creator = [user.name]
|
|
32
|
+
# TODO: Remove this? see https://github.com/projecthydra-labs/curation_concerns/issues/27
|
|
33
|
+
if batch_id && generic_file.respond_to?(:batch_id=)
|
|
34
|
+
generic_file.batch_id = batch_id
|
|
35
|
+
else
|
|
36
|
+
ActiveFedora::Base.logger.warn "unable to find batch to attach to"
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
unless work_id.blank?
|
|
40
|
+
work = ActiveFedora::Base.find(work_id)
|
|
41
|
+
|
|
42
|
+
if !((generic_file_params || {}).keys & ["visibility", "embargo_release_date", "lease_expiration_date"]).empty?
|
|
43
|
+
interpret_visibility generic_file_params
|
|
44
|
+
else
|
|
45
|
+
copy_visibility(work, generic_file)
|
|
46
|
+
end
|
|
47
|
+
work.generic_files << generic_file
|
|
48
|
+
# Save the work so the association between the work and the generic_file is persisted (head_id)
|
|
49
|
+
work.save
|
|
50
|
+
end
|
|
51
|
+
yield(generic_file) if block_given?
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def create_content(file)
|
|
55
|
+
# Tell UploadFileToGenericFile service to skip versioning because versions will be minted by VersionCommitter (called by save_characterize_and_record_committer) when necessary
|
|
56
|
+
Hydra::Works::UploadFileToGenericFile.call(generic_file, file, versioning: false)
|
|
57
|
+
generic_file.label ||= file.original_filename
|
|
58
|
+
generic_file.title = [generic_file.label] if generic_file.title.blank?
|
|
59
|
+
save_characterize_and_record_committer do
|
|
60
|
+
if CurationConcerns.config.respond_to?(:after_create_content)
|
|
61
|
+
CurationConcerns.config.after_create_content.call(generic_file, user)
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def revert_content(revision_id)
|
|
67
|
+
generic_file.original_file.restore_version(revision_id)
|
|
68
|
+
save_characterize_and_record_committer do
|
|
69
|
+
if CurationConcerns.config.respond_to?(:after_revert_content)
|
|
70
|
+
CurationConcerns.config.after_revert_content.call(generic_file, user, revision_id)
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def update_content(file)
|
|
76
|
+
# Tell UploadFileToGenericFile service to skip versioning because versions will be minted by VersionCommitter (called by save_characterize_and_record_committer) when necessary
|
|
77
|
+
Hydra::Works::UploadFileToGenericFile.call(generic_file, file, versioning: false)
|
|
78
|
+
save_characterize_and_record_committer do
|
|
79
|
+
if CurationConcerns.config.respond_to?(:after_update_content)
|
|
80
|
+
CurationConcerns.config.after_update_content.call(generic_file, user)
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def update_metadata(model_attributes, all_attributes)
|
|
86
|
+
update_visibility(all_attributes)
|
|
87
|
+
model_attributes.delete(:visibility) # Applying this attribute is handled by update_visibility
|
|
88
|
+
generic_file.attributes = model_attributes
|
|
89
|
+
generic_file.date_modified = DateTime.now
|
|
90
|
+
save do
|
|
91
|
+
if CurationConcerns.config.respond_to?(:after_update_metadata)
|
|
92
|
+
CurationConcerns.config.after_update_metadata.call(generic_file, user)
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def destroy
|
|
98
|
+
generic_file.destroy
|
|
99
|
+
if CurationConcerns.config.respond_to?(:after_destroy)
|
|
100
|
+
CurationConcerns.config.after_destroy.call(generic_file.id, user)
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Saves the generic file, queues a job to characterize it, and records the committer.
|
|
105
|
+
# Takes a block which is run if the save was successful.
|
|
106
|
+
def save_characterize_and_record_committer
|
|
107
|
+
save do
|
|
108
|
+
push_characterize_job
|
|
109
|
+
CurationConcerns::VersioningService.create(generic_file.original_file, user)
|
|
110
|
+
yield if block_given?
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# Takes an optional block and executes the block if the save was successful.
|
|
115
|
+
# returns false if the save was unsuccessful
|
|
116
|
+
def save
|
|
117
|
+
save_tries = 0
|
|
118
|
+
begin
|
|
119
|
+
return false unless generic_file.save
|
|
120
|
+
rescue RSolr::Error::Http => error
|
|
121
|
+
ActiveFedora::Base.logger.warn "CurationConcerns::GenericFileActor#save Caught RSOLR error #{error.inspect}"
|
|
122
|
+
save_tries+=1
|
|
123
|
+
# fail for good if the tries is greater than 3
|
|
124
|
+
raise error if save_tries >=3
|
|
125
|
+
sleep 0.01
|
|
126
|
+
retry
|
|
127
|
+
end
|
|
128
|
+
yield if block_given?
|
|
129
|
+
true
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def push_characterize_job
|
|
133
|
+
CurationConcerns.queue.push(CharacterizeJob.new(@generic_file.id))
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
protected
|
|
137
|
+
|
|
138
|
+
# This method can be overridden in case there is a custom approach for visibility (e.g. embargo)
|
|
139
|
+
def update_visibility(attributes)
|
|
140
|
+
interpret_visibility(attributes) # relies on CurationConcerns::ManagesEmbargoesActor to interpret and apply visibility
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
private
|
|
144
|
+
|
|
145
|
+
# copy visibility from source_concern to destination_concern
|
|
146
|
+
def copy_visibility(source_concern, destination_concern)
|
|
147
|
+
destination_concern.visibility = source_concern.visibility
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
end
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
|
|
2
|
+
module CurationConcerns::WorkActorBehavior
|
|
3
|
+
include CurationConcerns::ManagesEmbargoesActor
|
|
4
|
+
|
|
5
|
+
def create
|
|
6
|
+
# set the @files ivar then remove the files attribute so it isn't set by default.
|
|
7
|
+
files && attributes.delete(:files)
|
|
8
|
+
# Files must be attached before saving in order to persist their relationship to the work
|
|
9
|
+
assign_pid && interpret_visibility && attach_files && super && assign_representative && copy_visibility
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def update
|
|
13
|
+
add_to_collections(attributes.delete(:collection_ids)) &&
|
|
14
|
+
interpret_visibility && super && attach_files && copy_visibility
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
delegate :visibility_changed?, to: :curation_concern
|
|
18
|
+
|
|
19
|
+
protected
|
|
20
|
+
|
|
21
|
+
# Is this here to ensure that the curation_concern has a pid set before any of the other methods are executed?
|
|
22
|
+
def assign_pid
|
|
23
|
+
curation_concern.send(:assign_id)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def files
|
|
27
|
+
return @files if defined?(@files)
|
|
28
|
+
@files = [attributes[:files]].flatten.compact
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def attach_files
|
|
32
|
+
files.all? do |file|
|
|
33
|
+
attach_file(file)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# The default behavior of active_fedora's aggregates association,
|
|
38
|
+
# when assigning the id accessor (e.g. collection_ids = ['foo:1']) is to add
|
|
39
|
+
# to new collections, but not remove from old collections.
|
|
40
|
+
# This method ensures it's removed from the old collections.
|
|
41
|
+
def add_to_collections(new_collection_ids)
|
|
42
|
+
return true unless new_collection_ids
|
|
43
|
+
# remove from old collections
|
|
44
|
+
# TODO Implement parent_collection_ids https://github.com/projecthydra-labs/hydra-pcdm/issues/157
|
|
45
|
+
(curation_concern.parent_collections.map(&:id) - new_collection_ids).each do |old_id|
|
|
46
|
+
Collection.find(old_id).members.delete(curation_concern)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
#add to new
|
|
50
|
+
new_collection_ids.each do |coll_id|
|
|
51
|
+
collection = Collection.find(coll_id)
|
|
52
|
+
collection.members << curation_concern
|
|
53
|
+
collection.save
|
|
54
|
+
end
|
|
55
|
+
true
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def assign_representative
|
|
59
|
+
@generic_files ||= []
|
|
60
|
+
unless curation_concern.representative
|
|
61
|
+
curation_concern.representative = @generic_files.first.id unless @generic_files.empty?
|
|
62
|
+
end
|
|
63
|
+
curation_concern.save
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
private
|
|
67
|
+
|
|
68
|
+
def attach_file(file)
|
|
69
|
+
generic_file = ::GenericFile.new
|
|
70
|
+
generic_file_actor = CurationConcerns::GenericFileActor.new(generic_file, user)
|
|
71
|
+
#TODO we're passing an ID rather than an object. This means the actor does an unnecessary lookup
|
|
72
|
+
generic_file_actor.create_metadata(curation_concern.id, curation_concern.id)
|
|
73
|
+
generic_file.visibility = visibility
|
|
74
|
+
generic_file_actor.create_content(file)
|
|
75
|
+
@generic_files ||= []
|
|
76
|
+
@generic_files << generic_file # This is so that other methods like assign_representative can access the generic_files wihtout reloading them from fedora
|
|
77
|
+
curation_concern.generic_files << generic_file
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def valid_file?(file_path)
|
|
81
|
+
return file_path.present? && File.exists?(file_path) && !File.zero?(file_path)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# The path of the fedora node where we store the file data
|
|
85
|
+
def file_path
|
|
86
|
+
'content'
|
|
87
|
+
end
|
|
88
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
class ActiveFedoraIdBasedJob
|
|
2
|
+
def queue_name
|
|
3
|
+
:id_based
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
attr_accessor :id
|
|
7
|
+
|
|
8
|
+
def initialize(id)
|
|
9
|
+
self.id = id
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def object
|
|
13
|
+
@object ||= ActiveFedora::Base.find(id)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
alias_method :generic_file, :object
|
|
17
|
+
alias_method :generic_file_id, :id
|
|
18
|
+
|
|
19
|
+
def run
|
|
20
|
+
raise RuntimeError, "Define #run in a subclass"
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
class AuditJob < ActiveFedoraIdBasedJob
|
|
2
|
+
def queue_name
|
|
3
|
+
:audit
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
attr_accessor :uri, :id, :file_id
|
|
7
|
+
|
|
8
|
+
# URI of the resource to audit.
|
|
9
|
+
# This URI could include the actual resource (e.g. content) and the version to audit:
|
|
10
|
+
# http://localhost:8983/fedora/rest/test/a/b/c/abcxyz/content/fcr:versions/version1
|
|
11
|
+
# but it could also just be:
|
|
12
|
+
# http://localhost:8983/fedora/rest/test/a/b/c/abcxyz/content
|
|
13
|
+
# @param [String] id of the parent object
|
|
14
|
+
# @param [String] file_id used to find the file within its parent object (usually "original_file")
|
|
15
|
+
# @param [String] uri of the specific file/version to be audited
|
|
16
|
+
def initialize(id, file_id, uri)
|
|
17
|
+
super(id)
|
|
18
|
+
self.file_id = file_id
|
|
19
|
+
self.uri = uri
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def run
|
|
23
|
+
fixity_ok = false
|
|
24
|
+
log = run_audit
|
|
25
|
+
fixity_ok = (log.pass == 1)
|
|
26
|
+
unless fixity_ok
|
|
27
|
+
if CurationConcerns.config.respond_to?(:after_audit_failure)
|
|
28
|
+
login = generic_file.depositor
|
|
29
|
+
user = User.find_by_user_key(login)
|
|
30
|
+
CurationConcerns.config.after_audit_failure.call(generic_file, user, log.created_at)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
fixity_ok
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
protected
|
|
37
|
+
|
|
38
|
+
def run_audit
|
|
39
|
+
begin
|
|
40
|
+
fixity_ok = ActiveFedora::FixityService.new(uri).check
|
|
41
|
+
rescue Ldp::NotFound
|
|
42
|
+
error_msg = "resource not found"
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
if fixity_ok
|
|
46
|
+
passing = 1
|
|
47
|
+
ChecksumAuditLog.prune_history(id, file_id)
|
|
48
|
+
else
|
|
49
|
+
logger.warn "***AUDIT*** Audit failed for #{uri} #{error_msg}"
|
|
50
|
+
passing = 0
|
|
51
|
+
end
|
|
52
|
+
ChecksumAuditLog.create!(pass: passing, generic_file_id: id, version: uri, file_id: file_id)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def logger
|
|
56
|
+
ActiveFedora::Base.logger
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
class CharacterizeJob < ActiveFedoraIdBasedJob
|
|
2
|
+
def queue_name
|
|
3
|
+
:characterize
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
def run
|
|
7
|
+
CurationConcerns::CharacterizationService.run(generic_file)
|
|
8
|
+
generic_file.save
|
|
9
|
+
CurationConcerns.queue.push(CreateDerivativesJob.new(generic_file.id))
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
class CopyPermissionsJob
|
|
2
|
+
def queue_name
|
|
3
|
+
:permissions
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
attr_accessor :id
|
|
7
|
+
|
|
8
|
+
def initialize(id)
|
|
9
|
+
self.id = id
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def run
|
|
13
|
+
# work = ActiveFedora::Base.load_instance_from_solr(id)
|
|
14
|
+
work = ActiveFedora::Base.find(id) # Hydra::Works::GenericWork is not compatible with load_instance_from_solr. Using (slower) ActiveFedora::Base.find instead.
|
|
15
|
+
if work.respond_to?(:generic_files)
|
|
16
|
+
work.generic_files.each do |file|
|
|
17
|
+
|
|
18
|
+
work.permissions.each {|perm| file.permissions << Hydra::AccessControls::Permission.new(perm.to_hash)}
|
|
19
|
+
new_permissions = file.permissions.uniq! { |item| item.to_hash}
|
|
20
|
+
file.permissions = new_permissions unless new_permissions.blank?
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
class CreateDerivativesJob < ActiveFedoraIdBasedJob
|
|
2
|
+
def queue_name
|
|
3
|
+
:derivatives
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
def run
|
|
7
|
+
return unless generic_file.original_file.has_content?
|
|
8
|
+
if generic_file.video?
|
|
9
|
+
return unless CurationConcerns.config.enable_ffmpeg
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
generic_file.create_derivatives
|
|
13
|
+
generic_file.save
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
require 'net/https'
|
|
2
|
+
require 'uri'
|
|
3
|
+
require 'tempfile'
|
|
4
|
+
|
|
5
|
+
class ImportUrlJob < ActiveFedoraIdBasedJob
|
|
6
|
+
|
|
7
|
+
def queue_name
|
|
8
|
+
:import_url
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def run
|
|
12
|
+
user = User.find_by_user_key(generic_file.depositor)
|
|
13
|
+
|
|
14
|
+
Tempfile.open(id.gsub('/', '_')) do |f|
|
|
15
|
+
copy_remote_file(generic_file.import_url, f)
|
|
16
|
+
# attach downloaded file to generic file stubbed out
|
|
17
|
+
if CurationConcerns::GenericFileActor.new(generic_file, user).create_content(f)
|
|
18
|
+
|
|
19
|
+
# send message to user on download success
|
|
20
|
+
if CurationConcerns.config.respond_to?(:after_import_url_success)
|
|
21
|
+
CurationConcerns.config.after_import_url_success.call(generic_file, user)
|
|
22
|
+
end
|
|
23
|
+
else
|
|
24
|
+
|
|
25
|
+
# send message to user on download failure
|
|
26
|
+
if CurationConcerns.config.respond_to?(:after_import_url_failure)
|
|
27
|
+
CurationConcerns.config.after_import_url_failure.call(generic_file, user)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def copy_remote_file(import_url, f)
|
|
34
|
+
f.binmode
|
|
35
|
+
# download file from url
|
|
36
|
+
uri = URI(generic_file.import_url)
|
|
37
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
|
38
|
+
http.use_ssl = uri.scheme == "https" # enable SSL/TLS
|
|
39
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
|
40
|
+
mime_type = nil
|
|
41
|
+
|
|
42
|
+
http.start do
|
|
43
|
+
http.request_get(uri.request_uri) do |resp|
|
|
44
|
+
mime_type = resp.content_type
|
|
45
|
+
resp.read_body do |segment|
|
|
46
|
+
f.write(segment)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
f.rewind
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def job_user
|
|
54
|
+
User.batchuser
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
class IngestLocalFileJob
|
|
2
|
+
attr_accessor :directory, :filename, :user_key, :generic_file_id
|
|
3
|
+
|
|
4
|
+
def queue_name
|
|
5
|
+
:ingest
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def initialize(generic_file_id, directory, filename, user_key)
|
|
9
|
+
self.generic_file_id = generic_file_id
|
|
10
|
+
self.directory = directory
|
|
11
|
+
self.filename = filename
|
|
12
|
+
self.user_key = user_key
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def run
|
|
16
|
+
user = User.find_by_user_key(user_key)
|
|
17
|
+
raise "Unable to find user for #{user_key}" unless user
|
|
18
|
+
generic_file = GenericFile.find(generic_file_id)
|
|
19
|
+
generic_file.label ||= filename
|
|
20
|
+
path = File.join(directory, filename)
|
|
21
|
+
|
|
22
|
+
actor = CurationConcerns::GenericFileActor.new(generic_file, user)
|
|
23
|
+
|
|
24
|
+
if actor.create_content(File.open(path))
|
|
25
|
+
FileUtils.rm(path)
|
|
26
|
+
|
|
27
|
+
# send message to user on import success
|
|
28
|
+
if CurationConcerns.config.respond_to?(:after_import_local_file_success)
|
|
29
|
+
CurationConcerns.config.after_import_local_file_success.call(generic_file, user, filename)
|
|
30
|
+
end
|
|
31
|
+
else
|
|
32
|
+
|
|
33
|
+
# send message to user on import failure
|
|
34
|
+
if CurationConcerns.config.respond_to?(:after_import_local_file_failure)
|
|
35
|
+
CurationConcerns.config.after_import_local_file_failure.call(generic_file, user, filename)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def job_user
|
|
41
|
+
User.batchuser
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def mime_type(file_name)
|
|
45
|
+
mime_types = MIME::Types.of(file_name)
|
|
46
|
+
mime_types.empty? ? "application/octet-stream" : mime_types.first.content_type
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
class ChecksumAuditLog < ActiveRecord::Base
|
|
2
|
+
|
|
3
|
+
def self.get_audit_log(id, path, version_uri)
|
|
4
|
+
ChecksumAuditLog.find_or_create_by(generic_file_id: id, file_id: path, version: version_uri)
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
# Check to see if there are previous passing logs that we can delete
|
|
8
|
+
# we want to keep the first passing event after a failure, the most current passing event,
|
|
9
|
+
# and all failures so that this table doesn't grow too large
|
|
10
|
+
# Simple way (a little naieve): if the last 2 were passing, delete the first one
|
|
11
|
+
def self.prune_history(id, path)
|
|
12
|
+
list = logs_for(id, path).limit(2)
|
|
13
|
+
if list.size > 1 && (list[0].pass == 1) && (list[1].pass == 1)
|
|
14
|
+
list[0].destroy
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def self.logs_for(id, path)
|
|
19
|
+
ChecksumAuditLog.where(generic_file_id: id, file_id: path).order('created_at desc, id desc')
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
module CurationConcerns
|
|
2
|
+
module Ability
|
|
3
|
+
extend ActiveSupport::Concern
|
|
4
|
+
included do
|
|
5
|
+
self.ability_logic += [:curation_concerns_permissions]
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def curation_concerns_permissions
|
|
9
|
+
|
|
10
|
+
unless current_user.new_record?
|
|
11
|
+
can :create, CurationConcerns::ClassifyConcern
|
|
12
|
+
# TODO: Shouldn't this be in `everyone_can_create_curation_concerns` ?
|
|
13
|
+
can :create, ::GenericFile
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
if user_groups.include? 'admin'
|
|
17
|
+
can [:create, :discover, :show, :read, :edit, :update, :destroy], :all
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
can :collect, :all
|
|
21
|
+
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Add this to your ability_logic if you want all logged in users to be able
|
|
25
|
+
# to submit content
|
|
26
|
+
def everyone_can_create_curation_concerns
|
|
27
|
+
unless current_user.new_record?
|
|
28
|
+
can :create, [ CurationConcerns.configuration.curation_concerns ]
|
|
29
|
+
can :create, ::Collection
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
module CurationConcerns
|
|
2
|
+
module BasicMetadata
|
|
3
|
+
extend ActiveSupport::Concern
|
|
4
|
+
|
|
5
|
+
included do
|
|
6
|
+
|
|
7
|
+
property :label, predicate: ActiveFedora::RDF::Fcrepo::Model.downloadFilename, multiple: false
|
|
8
|
+
|
|
9
|
+
property :depositor, predicate: ::RDF::URI.new("http://id.loc.gov/vocabulary/relators/dpt"), multiple: false do |index|
|
|
10
|
+
index.as :symbol, :stored_searchable
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
property :relative_path, predicate: ::RDF::URI.new('http://scholarsphere.psu.edu/ns#relativePath'), multiple: false
|
|
14
|
+
|
|
15
|
+
property :import_url, predicate: ::RDF::URI.new('http://scholarsphere.psu.edu/ns#importUrl'), multiple: false do |index|
|
|
16
|
+
index.as :symbol
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
property :part_of, predicate: ::RDF::DC.isPartOf
|
|
20
|
+
property :resource_type, predicate: ::RDF::DC.type do |index|
|
|
21
|
+
index.as :stored_searchable, :facetable
|
|
22
|
+
end
|
|
23
|
+
property :title, predicate: ::RDF::DC.title do |index|
|
|
24
|
+
index.as :stored_searchable, :facetable
|
|
25
|
+
end
|
|
26
|
+
property :creator, predicate: ::RDF::DC.creator do |index|
|
|
27
|
+
index.as :stored_searchable, :facetable
|
|
28
|
+
end
|
|
29
|
+
property :contributor, predicate: ::RDF::DC.contributor do |index|
|
|
30
|
+
index.as :stored_searchable, :facetable
|
|
31
|
+
end
|
|
32
|
+
property :description, predicate: ::RDF::DC.description do |index|
|
|
33
|
+
index.type :text
|
|
34
|
+
index.as :stored_searchable
|
|
35
|
+
end
|
|
36
|
+
property :tag, predicate: ::RDF::DC.relation do |index|
|
|
37
|
+
index.as :stored_searchable, :facetable
|
|
38
|
+
end
|
|
39
|
+
property :rights, predicate: ::RDF::DC.rights do |index|
|
|
40
|
+
index.as :stored_searchable
|
|
41
|
+
end
|
|
42
|
+
property :publisher, predicate: ::RDF::DC.publisher do |index|
|
|
43
|
+
index.as :stored_searchable, :facetable
|
|
44
|
+
end
|
|
45
|
+
property :date_created, predicate: ::RDF::DC.created do |index|
|
|
46
|
+
index.as :stored_searchable
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# We reserve date_uploaded for the original creation date of the record.
|
|
50
|
+
# For example, when migrating data from a fedora3 repo to fedora4,
|
|
51
|
+
# fedora's system created date will reflect the date when the record
|
|
52
|
+
# was created in fedora4, but the date_uploaded will preserve the
|
|
53
|
+
# original creation date from the old repository.
|
|
54
|
+
property :date_uploaded, predicate: ::RDF::DC.dateSubmitted, multiple: false do |index|
|
|
55
|
+
index.type :date
|
|
56
|
+
index.as :stored_sortable
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
property :date_modified, predicate: ::RDF::DC.modified, multiple: false do |index|
|
|
60
|
+
index.type :date
|
|
61
|
+
index.as :stored_sortable
|
|
62
|
+
end
|
|
63
|
+
property :subject, predicate: ::RDF::DC.subject do |index|
|
|
64
|
+
index.as :stored_searchable, :facetable
|
|
65
|
+
end
|
|
66
|
+
property :language, predicate: ::RDF::DC.language do |index|
|
|
67
|
+
index.as :stored_searchable, :facetable
|
|
68
|
+
end
|
|
69
|
+
property :identifier, predicate: ::RDF::DC.identifier do |index|
|
|
70
|
+
index.as :stored_searchable
|
|
71
|
+
end
|
|
72
|
+
property :based_near, predicate: ::RDF::FOAF.based_near do |index|
|
|
73
|
+
index.as :stored_searchable, :facetable
|
|
74
|
+
end
|
|
75
|
+
property :related_url, predicate: ::RDF::RDFS.seeAlso do |index|
|
|
76
|
+
index.as :stored_searchable
|
|
77
|
+
end
|
|
78
|
+
property :bibliographic_citation, predicate: ::RDF::DC.bibliographicCitation do |index|
|
|
79
|
+
index.as :stored_searchable
|
|
80
|
+
end
|
|
81
|
+
property :source, predicate: ::RDF::DC.source do |index|
|
|
82
|
+
index.as :stored_searchable
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
end
|
|
87
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
module CurationConcerns
|
|
2
|
+
module CollectionBehavior
|
|
3
|
+
extend ActiveSupport::Concern
|
|
4
|
+
|
|
5
|
+
include Hydra::AccessControls::WithAccessRight
|
|
6
|
+
include Hydra::Collection
|
|
7
|
+
include CurationConcerns::Noid
|
|
8
|
+
include CurationConcerns::HumanReadableType
|
|
9
|
+
include CurationConcerns::HasRepresentative
|
|
10
|
+
include CurationConcerns::Permissions
|
|
11
|
+
|
|
12
|
+
included do
|
|
13
|
+
validates :title, presence: true
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def add_member(collectible)
|
|
17
|
+
if can_add_to_members?(collectible)
|
|
18
|
+
self.members << collectible
|
|
19
|
+
save
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def to_s
|
|
24
|
+
title.present? ? title : "No Title"
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def bytes
|
|
28
|
+
members.reduce(0) { |sum, gf| sum + gf.content.size.to_i }
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def to_solr(solr_doc={})
|
|
32
|
+
super(solr_doc).tap do |solr_doc|
|
|
33
|
+
Solrizer.set_field(solr_doc, 'generic_type', human_readable_type, :facetable)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def can_be_member_of_collection?(collection)
|
|
38
|
+
collection == self ? false : true
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
private
|
|
42
|
+
|
|
43
|
+
def can_add_to_members?(collectible)
|
|
44
|
+
collectible.try(:can_be_member_of_collection?, self)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|