hyrax 3.0.1 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (388) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +49 -19
  3. data/.dassie/.env +1 -2
  4. data/.dassie/Gemfile +18 -9
  5. data/.dassie/app/controllers/catalog_controller.rb +6 -0
  6. data/.dassie/app/models/user.rb +0 -2
  7. data/.dassie/config/analytics.yml +12 -5
  8. data/.dassie/config/environments/development.rb +2 -0
  9. data/.dassie/config/initializers/hyrax.rb +7 -0
  10. data/.dassie/config/role_map.yml +2 -0
  11. data/.dassie/db/migrate/20210921150120_enable_uuid_extension.valkyrie_engine.rb +7 -0
  12. data/.dassie/db/migrate/20210921150121_create_orm_resources.valkyrie_engine.rb +19 -0
  13. data/.dassie/db/migrate/20210921150122_add_model_type_to_orm_resources.valkyrie_engine.rb +7 -0
  14. data/.dassie/db/migrate/20210921150123_change_model_type_to_internal_model.valkyrie_engine.rb +7 -0
  15. data/.dassie/db/migrate/20210921150124_create_path_gin_index.valkyrie_engine.rb +7 -0
  16. data/.dassie/db/migrate/20210921150125_create_internal_resource_index.valkyrie_engine.rb +7 -0
  17. data/.dassie/db/migrate/20210921150126_create_updated_at_index.valkyrie_engine.rb +7 -0
  18. data/.dassie/db/migrate/20210921150127_add_optimistic_locking_to_orm_resources.valkyrie_engine.rb +7 -0
  19. data/.dassie/db/migrate/20211130181150_create_default_administrative_set.rb +8 -0
  20. data/.dassie/db/schema.rb +20 -1
  21. data/.dassie/db/seeds.rb +1 -1
  22. data/.dockerignore +3 -0
  23. data/.env +8 -6
  24. data/.github/workflows/main.yml +17 -0
  25. data/.github/workflows/release.yml +17 -0
  26. data/.gitignore +1 -0
  27. data/.regen +1 -1
  28. data/.rubocop.yml +4 -0
  29. data/CONTAINERS.md +33 -10
  30. data/Dockerfile +14 -9
  31. data/Gemfile +21 -27
  32. data/README.md +37 -0
  33. data/app/actors/hyrax/actors/base_actor.rb +2 -2
  34. data/app/actors/hyrax/actors/collections_membership_actor.rb +3 -3
  35. data/app/actors/hyrax/actors/create_with_remote_files_actor.rb +85 -63
  36. data/app/actors/hyrax/actors/create_with_remote_files_ordered_members_actor.rb +7 -42
  37. data/app/actors/hyrax/actors/file_set_actor.rb +12 -5
  38. data/app/assets/javascripts/hyrax/admin/graphs.es6 +34 -37
  39. data/app/assets/javascripts/hyrax/analytics_events.js +69 -0
  40. data/app/assets/javascripts/hyrax/collapse.js +24 -0
  41. data/app/assets/javascripts/hyrax/collections.js +1 -2
  42. data/app/assets/javascripts/hyrax/ga_events.js +2 -8
  43. data/app/assets/javascripts/hyrax/reports-buttons.js +33 -0
  44. data/app/assets/javascripts/hyrax.js +2 -1
  45. data/app/assets/stylesheets/_bootstrap-default-overrides.scss +9 -0
  46. data/app/assets/stylesheets/hyrax/_styles.scss +5 -0
  47. data/app/authorities/qa/authorities/collections.rb +4 -5
  48. data/app/authorities/qa/authorities/find_works.rb +1 -1
  49. data/app/controllers/concerns/hyrax/breadcrumbs_for_collection_analytics.rb +26 -0
  50. data/app/controllers/concerns/hyrax/breadcrumbs_for_works_analytics.rb +26 -0
  51. data/app/controllers/concerns/hyrax/collections_controller_behavior.rb +30 -10
  52. data/app/controllers/concerns/hyrax/controller.rb +35 -2
  53. data/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb +21 -9
  54. data/app/controllers/concerns/hyrax/leases_controller_behavior.rb +14 -5
  55. data/app/controllers/concerns/hyrax/works_controller_behavior.rb +22 -3
  56. data/app/controllers/hyrax/admin/admin_sets_controller.rb +2 -19
  57. data/app/controllers/hyrax/admin/analytics/analytics_controller.rb +40 -0
  58. data/app/controllers/hyrax/admin/analytics/collection_reports_controller.rb +61 -0
  59. data/app/controllers/hyrax/admin/analytics/work_reports_controller.rb +122 -0
  60. data/app/controllers/hyrax/admin/permission_template_accesses_controller.rb +5 -6
  61. data/app/controllers/hyrax/admin/workflows_controller.rb +8 -2
  62. data/app/controllers/hyrax/collections_controller.rb +6 -1
  63. data/app/controllers/hyrax/dashboard/collection_members_controller.rb +24 -17
  64. data/app/controllers/hyrax/dashboard/collections_controller.rb +112 -37
  65. data/app/controllers/hyrax/dashboard/nest_collections_controller.rb +75 -39
  66. data/app/controllers/hyrax/dashboard_controller.rb +8 -0
  67. data/app/controllers/hyrax/file_sets_controller.rb +49 -13
  68. data/app/controllers/hyrax/my_controller.rb +4 -4
  69. data/app/controllers/hyrax/permissions_controller.rb +3 -4
  70. data/app/controllers/hyrax/stats_controller.rb +3 -1
  71. data/app/controllers/hyrax/workflow_actions_controller.rb +11 -6
  72. data/app/forms/hyrax/forms/administrative_set_form.rb +62 -0
  73. data/app/forms/hyrax/forms/collection_form.rb +9 -5
  74. data/app/forms/hyrax/forms/dashboard/nest_collection_form.rb +38 -6
  75. data/app/forms/hyrax/forms/file_set_form.rb +46 -0
  76. data/app/forms/hyrax/forms/pcdm_collection_form.rb +67 -0
  77. data/app/forms/hyrax/forms/permission.rb +23 -0
  78. data/app/forms/hyrax/forms/permission_template_form.rb +8 -2
  79. data/app/forms/hyrax/forms/resource_form.rb +34 -26
  80. data/app/forms/hyrax/forms/work_form.rb +5 -2
  81. data/app/forms/hyrax/forms/workflow_action_form.rb +4 -0
  82. data/app/helpers/hyrax/batch_edits_helper.rb +3 -1
  83. data/app/helpers/hyrax/collections_helper.rb +88 -2
  84. data/app/helpers/hyrax/dashboard_helper_behavior.rb +16 -5
  85. data/app/helpers/hyrax/embargo_helper.rb +4 -0
  86. data/app/helpers/hyrax/file_set_helper.rb +25 -6
  87. data/app/helpers/hyrax/hyrax_helper_behavior.rb +9 -0
  88. data/app/helpers/hyrax/lease_helper.rb +4 -0
  89. data/app/helpers/hyrax/url_helper.rb +4 -1
  90. data/app/helpers/hyrax/work_form_helper.rb +53 -0
  91. data/app/indexers/hyrax/administrative_set_indexer.rb +18 -0
  92. data/app/indexers/hyrax/pcdm_collection_indexer.rb +2 -0
  93. data/app/indexers/hyrax/valkyrie_file_set_indexer.rb +3 -1
  94. data/app/indexers/hyrax/valkyrie_indexer.rb +3 -3
  95. data/app/indexers/hyrax/valkyrie_work_indexer.rb +1 -1
  96. data/app/inputs/controlled_vocabulary_input.rb +2 -5
  97. data/app/jobs/attach_files_to_work_job.rb +19 -10
  98. data/app/jobs/attach_files_to_work_with_ordered_members_job.rb +6 -5
  99. data/app/jobs/characterize_job.rb +28 -1
  100. data/app/jobs/ingest_local_file_job.rb +18 -2
  101. data/app/jobs/inherit_permissions_job.rb +9 -5
  102. data/app/jobs/valkyrie_ingest_job.rb +56 -0
  103. data/app/models/admin_set.rb +22 -30
  104. data/app/models/collection_branding_info.rb +25 -9
  105. data/app/models/concerns/hyrax/ability/admin_set_ability.rb +31 -7
  106. data/app/models/concerns/hyrax/ability/collection_ability.rb +35 -20
  107. data/app/models/concerns/hyrax/ability/collection_type_ability.rb +1 -1
  108. data/app/models/concerns/hyrax/ability.rb +31 -8
  109. data/app/models/concerns/hyrax/collection_behavior.rb +17 -44
  110. data/app/models/concerns/hyrax/embargoable.rb +24 -0
  111. data/app/models/concerns/hyrax/file_set/characterization.rb +18 -12
  112. data/app/models/concerns/hyrax/solr_document/metadata.rb +1 -0
  113. data/app/models/concerns/hyrax/solr_document_behavior.rb +11 -54
  114. data/app/models/concerns/hyrax/suppressible.rb +5 -0
  115. data/app/models/concerns/hyrax/user.rb +9 -3
  116. data/app/models/concerns/hyrax/work_behavior.rb +1 -1
  117. data/app/models/file_download_stat.rb +4 -4
  118. data/app/models/hyrax/administrative_set.rb +7 -1
  119. data/app/models/hyrax/default_administrative_set.rb +42 -0
  120. data/app/models/hyrax/file_set.rb +6 -0
  121. data/app/models/hyrax/pcdm_collection.rb +1 -0
  122. data/app/models/hyrax/permission.rb +1 -1
  123. data/app/models/hyrax/permission_template.rb +112 -12
  124. data/app/models/hyrax/statistic.rb +31 -4
  125. data/app/models/hyrax/virus_scanner.rb +27 -18
  126. data/app/models/hyrax/work.rb +1 -0
  127. data/app/models/hyrax/workflow_action_info.rb +16 -0
  128. data/app/models/sipity/agent.rb +1 -0
  129. data/app/models/sipity/comment.rb +17 -0
  130. data/app/models/sipity/entity.rb +30 -8
  131. data/app/models/sipity/workflow.rb +1 -0
  132. data/app/models/sipity.rb +53 -2
  133. data/app/presenters/hyrax/admin/dashboard_presenter.rb +8 -6
  134. data/app/presenters/hyrax/admin/repository_growth_presenter.rb +10 -5
  135. data/app/presenters/hyrax/admin/user_activity_presenter.rb +8 -12
  136. data/app/presenters/hyrax/admin_set_options_presenter.rb +12 -8
  137. data/app/presenters/hyrax/admin_set_presenter.rb +13 -4
  138. data/app/presenters/hyrax/admin_set_selection_presenter.rb +116 -0
  139. data/app/presenters/hyrax/collection_presenter.rb +34 -9
  140. data/app/presenters/hyrax/file_set_presenter.rb +8 -1
  141. data/app/presenters/hyrax/file_usage.rb +3 -2
  142. data/app/presenters/hyrax/menu_presenter.rb +4 -0
  143. data/app/presenters/hyrax/pcdm_member_presenter_factory.rb +119 -0
  144. data/app/presenters/hyrax/stats_usage_presenter.rb +2 -1
  145. data/app/presenters/hyrax/trophy_presenter.rb +33 -4
  146. data/app/presenters/hyrax/user_profile_presenter.rb +11 -1
  147. data/app/presenters/hyrax/version_list_presenter.rb +19 -0
  148. data/app/presenters/hyrax/version_presenter.rb +3 -2
  149. data/app/presenters/hyrax/work_show_presenter.rb +37 -8
  150. data/app/presenters/hyrax/work_usage.rb +6 -3
  151. data/app/renderers/hyrax/renderers/attribute_renderer.rb +10 -2
  152. data/app/search_builders/hyrax/README.md +1 -1
  153. data/app/search_builders/hyrax/abstract_type_relation.rb +4 -2
  154. data/app/search_builders/hyrax/admin_set_search_builder.rb +1 -1
  155. data/app/search_builders/hyrax/collection_member_search_builder.rb +6 -1
  156. data/app/search_builders/hyrax/dashboard/collections_search_builder.rb +1 -1
  157. data/app/search_builders/hyrax/exposed_models_relation.rb +1 -1
  158. data/app/search_builders/hyrax/filter_by_type.rb +1 -2
  159. data/app/search_builders/hyrax/my/collections_search_builder.rb +2 -2
  160. data/app/search_builders/hyrax/nested_collections_parent_search_builder.rb +1 -1
  161. data/app/search_builders/hyrax/single_collection_search_builder.rb +1 -1
  162. data/app/services/hyrax/admin_set_create_service.rb +199 -53
  163. data/app/services/hyrax/analytics/google/events.rb +37 -0
  164. data/app/services/hyrax/analytics/google/events_daily.rb +72 -0
  165. data/app/services/hyrax/analytics/google/visits.rb +44 -0
  166. data/app/services/hyrax/analytics/google/visits_daily.rb +49 -0
  167. data/app/services/hyrax/analytics/google.rb +204 -0
  168. data/app/services/hyrax/analytics/matomo.rb +193 -0
  169. data/app/services/hyrax/analytics/results.rb +79 -0
  170. data/app/services/hyrax/analytics.rb +12 -82
  171. data/app/services/hyrax/characterization/valkyrie_characterization_service.rb +134 -0
  172. data/app/services/hyrax/collection_types/permissions_service.rb +1 -1
  173. data/app/services/hyrax/collections/collection_member_search_service.rb +72 -0
  174. data/app/services/hyrax/collections/collection_member_service.rb +122 -27
  175. data/app/services/hyrax/collections/migration_service.rb +4 -2
  176. data/app/services/hyrax/collections/nested_collection_persistence_service.rb +12 -13
  177. data/app/services/hyrax/collections/nested_collection_query_service.rb +10 -3
  178. data/app/services/hyrax/collections/permissions_create_service.rb +82 -78
  179. data/app/services/hyrax/collections/permissions_service.rb +1 -1
  180. data/app/services/hyrax/contextual_path.rb +24 -1
  181. data/app/services/hyrax/curation_concern.rb +24 -2
  182. data/app/services/hyrax/custom_queries/find_file_metadata.rb +7 -5
  183. data/app/services/hyrax/custom_queries/navigators/parent_collections_navigator.rb +46 -0
  184. data/app/services/hyrax/default_middleware_stack.rb +11 -0
  185. data/app/services/hyrax/edit_permissions_service.rb +74 -41
  186. data/app/services/hyrax/ensure_well_formed_admin_set_service.rb +3 -3
  187. data/app/services/hyrax/find_objects_via_solr_service.rb +31 -0
  188. data/app/services/hyrax/listeners/acl_index_listener.rb +3 -1
  189. data/app/services/hyrax/listeners/active_fedora_acl_index_listener.rb +4 -1
  190. data/app/services/hyrax/listeners/batch_notification_listener.rb +3 -1
  191. data/app/services/hyrax/listeners/file_metadata_listener.rb +19 -0
  192. data/app/services/hyrax/listeners/file_set_lifecycle_listener.rb +6 -2
  193. data/app/services/hyrax/listeners/file_set_lifecycle_notification_listener.rb +6 -2
  194. data/app/services/hyrax/listeners/member_cleanup_listener.rb +3 -0
  195. data/app/services/hyrax/listeners/metadata_index_listener.rb +33 -11
  196. data/app/services/hyrax/listeners/object_lifecycle_listener.rb +9 -3
  197. data/app/services/hyrax/listeners/proxy_deposit_listener.rb +3 -1
  198. data/app/services/hyrax/listeners/trophy_cleanup_listener.rb +3 -0
  199. data/app/services/hyrax/listeners/workflow_listener.rb +3 -1
  200. data/app/services/hyrax/listeners.rb +8 -0
  201. data/app/services/hyrax/multiple_membership_checker.rb +53 -29
  202. data/app/services/hyrax/permission_manager.rb +4 -4
  203. data/app/services/hyrax/resource_status.rb +7 -0
  204. data/app/services/hyrax/restriction_service.rb +4 -0
  205. data/app/services/hyrax/search_service.rb +4 -2
  206. data/app/services/hyrax/solr_query_builder_service.rb +45 -8
  207. data/app/services/hyrax/solr_query_service.rb +224 -0
  208. data/app/services/hyrax/solr_service.rb +9 -2
  209. data/app/services/hyrax/statistics/collections/over_time.rb +2 -1
  210. data/app/services/hyrax/statistics/depositors/summary.rb +2 -1
  211. data/app/services/hyrax/statistics/users/over_time.rb +8 -5
  212. data/app/services/hyrax/statistics/works/over_time.rb +10 -0
  213. data/app/services/hyrax/visibility_intention.rb +20 -2
  214. data/app/services/hyrax/work_uploads_handler.rb +21 -3
  215. data/app/services/hyrax/workflow/abstract_notification.rb +2 -2
  216. data/app/services/hyrax/workflow/action_taken_service.rb +16 -4
  217. data/app/services/hyrax/workflow/actionable_objects.rb +70 -0
  218. data/app/services/hyrax/workflow/activate_object.rb +5 -4
  219. data/app/services/hyrax/workflow/changes_required_notification.rb +5 -4
  220. data/app/services/hyrax/workflow/deactivate_object.rb +7 -5
  221. data/app/services/hyrax/workflow/deposited_notification.rb +8 -4
  222. data/app/services/hyrax/workflow/grant_edit_to_depositor.rb +7 -3
  223. data/app/services/hyrax/workflow/grant_read_to_depositor.rb +10 -3
  224. data/app/services/hyrax/workflow/object_in_workflow_decorator.rb +31 -0
  225. data/app/services/hyrax/workflow/revoke_edit_from_depositor.rb +8 -2
  226. data/app/services/hyrax/workflow/status_list_service.rb +43 -13
  227. data/app/services/hyrax/workflow/workflow_action_service.rb +4 -1
  228. data/app/views/hyrax/admin/admin_sets/_form.html.erb +1 -1
  229. data/app/views/hyrax/admin/analytics/_date_range_form.html.erb +11 -0
  230. data/app/views/hyrax/admin/analytics/collection_reports/_custom_range.html.erb +39 -0
  231. data/app/views/hyrax/admin/analytics/collection_reports/_monthly_summary.html.erb +48 -0
  232. data/app/views/hyrax/admin/analytics/collection_reports/_summary.html.erb +55 -0
  233. data/app/views/hyrax/admin/analytics/collection_reports/_top_collections.html.erb +55 -0
  234. data/app/views/hyrax/admin/analytics/collection_reports/index.html.erb +70 -0
  235. data/app/views/hyrax/admin/analytics/collection_reports/show.html.erb +94 -0
  236. data/app/views/hyrax/admin/analytics/work_reports/_custom_range.html.erb +43 -0
  237. data/app/views/hyrax/admin/analytics/work_reports/_monthly_summary.html.erb +35 -0
  238. data/app/views/hyrax/admin/analytics/work_reports/_summary.html.erb +60 -0
  239. data/app/views/hyrax/admin/analytics/work_reports/_top_file_set_downloads.html.erb +33 -0
  240. data/app/views/hyrax/admin/analytics/work_reports/_top_works.html.erb +40 -0
  241. data/app/views/hyrax/admin/analytics/work_reports/_work_counts.html.erb +18 -0
  242. data/app/views/hyrax/admin/analytics/work_reports/_work_files.html.erb +41 -0
  243. data/app/views/hyrax/admin/analytics/work_reports/index.html.erb +77 -0
  244. data/app/views/hyrax/admin/analytics/work_reports/show.html.erb +90 -0
  245. data/app/views/hyrax/admin/stats/show.html.erb +1 -1
  246. data/app/views/hyrax/base/_form_child_work_relationships.html.erb +1 -1
  247. data/app/views/hyrax/base/_form_relationships.html.erb +1 -2
  248. data/app/views/hyrax/base/_form_rendering.html.erb +1 -1
  249. data/app/views/hyrax/base/_form_representative.html.erb +1 -1
  250. data/app/views/hyrax/base/_form_thumbnail.html.erb +1 -1
  251. data/app/views/hyrax/base/_form_visibility_error.html.erb +2 -0
  252. data/app/views/hyrax/base/_guts4form.html.erb +3 -3
  253. data/app/views/hyrax/base/_relationships_parent_row.html.erb +0 -1
  254. data/app/views/hyrax/base/_representative_media.html.erb +1 -1
  255. data/app/views/hyrax/base/_show_actions.html.erb +2 -2
  256. data/app/views/hyrax/base/_work_button_row.html.erb +1 -1
  257. data/app/views/hyrax/base/show.html.erb +6 -0
  258. data/app/views/hyrax/batch_uploads/_form.html.erb +1 -1
  259. data/app/views/hyrax/collections/show.html.erb +4 -0
  260. data/app/views/hyrax/dashboard/_repository_growth.html.erb +5 -5
  261. data/app/views/hyrax/dashboard/_resource_type_graph.html.erb +41 -0
  262. data/app/views/hyrax/dashboard/_sidebar.html.erb +4 -1
  263. data/app/views/hyrax/dashboard/_tabs.html.erb +11 -0
  264. data/app/views/hyrax/dashboard/_user_activity.html.erb +17 -23
  265. data/app/views/hyrax/dashboard/_user_activity_graph.html.erb +55 -0
  266. data/app/views/hyrax/dashboard/_visibility_graph.html.erb +31 -0
  267. data/app/views/hyrax/dashboard/_work_type_graph.html.erb +41 -0
  268. data/app/views/hyrax/dashboard/collections/_collection_title.html.erb +1 -1
  269. data/app/views/hyrax/dashboard/collections/_form.html.erb +6 -5
  270. data/app/views/hyrax/dashboard/collections/_list_collections.html.erb +1 -1
  271. data/app/views/hyrax/dashboard/collections/_sort_and_per_page.html.erb +1 -1
  272. data/app/views/hyrax/dashboard/collections/edit.html.erb +4 -2
  273. data/app/views/hyrax/dashboard/collections/new.html.erb +4 -2
  274. data/app/views/hyrax/dashboard/collections/show.html.erb +1 -1
  275. data/app/views/hyrax/dashboard/show_admin.html.erb +24 -45
  276. data/app/views/hyrax/dashboard/sidebar/_activity.html.erb +22 -0
  277. data/app/views/hyrax/file_sets/_actions.html.erb +4 -3
  278. data/app/views/hyrax/file_sets/edit.html.erb +1 -1
  279. data/app/views/hyrax/file_sets/media_display/_audio.html.erb +1 -1
  280. data/app/views/hyrax/file_sets/media_display/_default.html.erb +1 -1
  281. data/app/views/hyrax/file_sets/media_display/_image.html.erb +1 -1
  282. data/app/views/hyrax/file_sets/media_display/_office_document.html.erb +1 -1
  283. data/app/views/hyrax/file_sets/media_display/_pdf.html.erb +1 -1
  284. data/app/views/hyrax/file_sets/media_display/_video.html.erb +1 -1
  285. data/app/views/hyrax/file_sets/show.html.erb +7 -1
  286. data/app/views/hyrax/homepage/index.html.erb +1 -1
  287. data/app/views/hyrax/my/_admin_set_action_menu.html.erb +0 -11
  288. data/app/views/hyrax/my/_collection_action_menu.html.erb +1 -2
  289. data/app/views/hyrax/my/collections/_list_collections.html.erb +1 -1
  290. data/app/views/hyrax/my/collections/_modal_add_subcollection.html.erb +3 -5
  291. data/app/views/hyrax/my/collections/_modal_collection_types_to_create.html.erb +1 -1
  292. data/app/views/hyrax/my/collections/index.html.erb +1 -1
  293. data/app/views/hyrax/stats/_downloads.html.erb +18 -0
  294. data/app/views/hyrax/stats/_pageviews.html.erb +18 -0
  295. data/app/views/hyrax/stats/work.html.erb +17 -9
  296. data/app/views/layouts/_head_tag_content.html.erb +7 -2
  297. data/app/views/layouts/hyrax/dashboard.html.erb +1 -0
  298. data/app/views/layouts/hyrax.html.erb +1 -0
  299. data/app/views/{_ga.html.erb → shared/_ga.html.erb} +3 -7
  300. data/app/views/shared/_matomo.html.erb +15 -0
  301. data/app/views/shared/_read_only.html.erb +5 -0
  302. data/bin/db-migrate-seed.sh +3 -1
  303. data/bin/hyrax-entrypoint.sh +0 -14
  304. data/bin/solrcloud-assign-configset.sh +11 -3
  305. data/bin/solrcloud-upload-configset.sh +17 -6
  306. data/chart/hyrax/Chart.yaml +9 -5
  307. data/chart/hyrax/README.md +52 -5
  308. data/chart/hyrax/templates/_helpers.tpl +15 -1
  309. data/chart/hyrax/templates/branding-pvc.yaml +2 -2
  310. data/chart/hyrax/templates/configmap-env.yaml +6 -2
  311. data/chart/hyrax/templates/deployment-worker.yaml +42 -5
  312. data/chart/hyrax/templates/deployment.yaml +53 -0
  313. data/chart/hyrax/templates/derivatives-pvc.yaml +2 -2
  314. data/chart/hyrax/templates/ingress.yaml +13 -4
  315. data/chart/hyrax/templates/secrets.yaml +8 -0
  316. data/chart/hyrax/templates/uploads-pvc.yaml +2 -2
  317. data/chart/hyrax/values.yaml +84 -2
  318. data/config/brakeman.ignore +2 -2
  319. data/config/features.rb +3 -0
  320. data/config/i18n-tasks.yml +2 -2
  321. data/config/initializers/1_healthz.rb +1 -0
  322. data/config/initializers/listeners.rb +5 -4
  323. data/config/initializers/valkryrie_storage.rb +7 -0
  324. data/config/locales/hyrax.de.yml +195 -1
  325. data/config/locales/hyrax.en.yml +192 -13
  326. data/config/locales/hyrax.es.yml +195 -1
  327. data/config/locales/hyrax.fr.yml +195 -1
  328. data/config/locales/hyrax.it.yml +195 -1
  329. data/config/locales/hyrax.pt-BR.yml +195 -1
  330. data/config/locales/hyrax.zh.yml +195 -1
  331. data/config/routes.rb +4 -0
  332. data/db/seeds.rb +1 -1
  333. data/docker-compose.yml +42 -9
  334. data/documentation/developing-your-hyrax-based-app.md +4 -4
  335. data/documentation/legacyREADME.md +4 -4
  336. data/hyrax.gemspec +4 -2
  337. data/lib/generators/hyrax/templates/catalog_controller.rb +3 -1
  338. data/lib/generators/hyrax/templates/config/analytics.yml +13 -7
  339. data/lib/generators/hyrax/templates/config/initializers/hyrax.rb +15 -13
  340. data/lib/generators/hyrax/templates/db/migrate/20211130181150_create_default_administrative_set.rb.erb +8 -0
  341. data/lib/generators/hyrax/work/templates/feature_spec.rb.erb +4 -2
  342. data/lib/generators/hyrax/work_resource/templates/indexer_spec.rb.erb +1 -0
  343. data/lib/hyrax/active_fedora_dummy_model.rb +62 -0
  344. data/lib/hyrax/collection_name.rb +6 -2
  345. data/lib/hyrax/configuration.rb +114 -4
  346. data/lib/hyrax/engine.rb +9 -6
  347. data/lib/hyrax/errors.rb +2 -0
  348. data/lib/hyrax/form_fields.rb +1 -0
  349. data/lib/hyrax/publisher.rb +16 -0
  350. data/lib/hyrax/resource_name.rb +1 -0
  351. data/lib/hyrax/resource_sync/change_list_writer.rb +2 -2
  352. data/lib/hyrax/resource_sync/resource_list_writer.rb +2 -2
  353. data/lib/hyrax/specs/capybara.rb +5 -3
  354. data/lib/hyrax/specs/shared_specs/hydra_works.rb +2 -0
  355. data/lib/hyrax/specs/shared_specs/indexers.rb +6 -0
  356. data/lib/hyrax/specs/shared_specs/valkyrie_storage_versions.rb +9 -0
  357. data/lib/hyrax/transactions/admin_set_create.rb +22 -0
  358. data/lib/hyrax/transactions/collection_create.rb +25 -0
  359. data/lib/hyrax/transactions/collection_update.rb +20 -0
  360. data/lib/hyrax/transactions/container.rb +58 -0
  361. data/lib/hyrax/transactions/file_set_destroy.rb +21 -0
  362. data/lib/hyrax/transactions/steps/add_file_sets.rb +3 -2
  363. data/lib/hyrax/transactions/steps/add_to_collections.rb +13 -1
  364. data/lib/hyrax/transactions/steps/add_to_parent.rb +36 -0
  365. data/lib/hyrax/transactions/steps/apply_collection_type_permissions.rb +29 -0
  366. data/lib/hyrax/transactions/steps/remove_file_set_from_work.rb +47 -0
  367. data/lib/hyrax/transactions/steps/save.rb +18 -6
  368. data/lib/hyrax/transactions/steps/set_collection_type_gid.rb +35 -0
  369. data/lib/hyrax/transactions/work_create.rb +2 -1
  370. data/lib/hyrax/valkyrie_can_can_adapter.rb +1 -0
  371. data/lib/hyrax/valkyrie_simple_path_generator.rb +20 -0
  372. data/lib/hyrax/version.rb +1 -1
  373. data/lib/hyrax.rb +9 -0
  374. data/lib/tasks/collection_type_global_id.rake +1 -1
  375. data/lib/tasks/default_admin_set.rake +12 -11
  376. data/lib/tasks/regenerate_derivatives.rake +12 -0
  377. data/lib/wings/active_fedora_converter/default_work.rb +15 -0
  378. data/lib/wings/model_transformer.rb +17 -1
  379. data/lib/wings/orm_converter.rb +18 -2
  380. data/lib/wings/setup.rb +17 -0
  381. data/lib/wings/valkyrie/persister.rb +16 -0
  382. data/lib/wings/valkyrie/storage.rb +56 -1
  383. data/lib/wings.rb +0 -21
  384. data/template.rb +1 -1
  385. data/vendor/assets/javascripts/morris/morris.min.js +1 -7
  386. data/vendor/assets/stylesheets/morris.js/0.5.1/morris.css +1 -1
  387. metadata +120 -17
  388. data/app/views/hyrax/dashboard/_repository_objects.html.erb +0 -28
@@ -12,7 +12,7 @@ RSpec.feature 'Create a <%= class_name %>', js: false do
12
12
  let(:user) do
13
13
  User.new(user_attributes) { |u| u.save(validate: false) }
14
14
  end
15
- let(:admin_set_id) { AdminSet.find_or_create_default_admin_set_id }
15
+ let(:admin_set_id) { Hyrax::AdminSetCreateService.find_or_create_default_admin_set.id.to_s }
16
16
  let(:permission_template) { Hyrax::PermissionTemplate.find_or_create_by!(source_id: admin_set_id) }
17
17
  let(:workflow) { Sipity::Workflow.create!(active: true, name: 'test-workflow', permission_template: permission_template) }
18
18
 
@@ -31,11 +31,13 @@ RSpec.feature 'Create a <%= class_name %>', js: false do
31
31
  end
32
32
 
33
33
  scenario do
34
+ pending 'Changes may be required for this test to pass. See TODO in test.'
35
+
34
36
  visit '/dashboard'
35
37
  click_link "Works"
36
38
  click_link "Add new work"
37
39
 
38
- # If you generate more than one work uncomment these lines
40
+ # TODO: If you generate more than one work uncomment these lines
39
41
  # choose "payload_concern", option: "<%= class_name %>"
40
42
  # click_button "Create work"
41
43
 
@@ -7,6 +7,7 @@ require 'hyrax/specs/shared_specs/indexers'
7
7
 
8
8
  RSpec.describe <%= class_name %>Indexer do
9
9
  let(:indexer_class) { described_class }
10
+ let(:resource) { <%= class_name %>.new }
10
11
 
11
12
  it_behaves_like 'a Hyrax::Resource indexer'
12
13
  end
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+ module Hyrax
3
+ ##
4
+ # @api public
5
+ #
6
+ # Given a model class and an +id+, provides +ActiveModel+ style methods. This
7
+ # is a tool for providing route resolution and other +ActiveModel+ behavior
8
+ # for +ActiveFedora+ without loading the object from the fedora backend.
9
+ #
10
+ # @note this was originally implemented for +SolrDocument+ as
11
+ # +Hyrax::SolrDocumentBehavior::ModelWrapper+, but is useful in the more
12
+ # general case that we know the model class and id, but don't have a full
13
+ # model object.
14
+ #
15
+ class ActiveFedoraDummyModel
16
+ ##
17
+ # @api public
18
+ #
19
+ # @param [Class] model
20
+ # @param [String, nil] id
21
+ def initialize(model, id)
22
+ @model = model
23
+ @id = id
24
+ end
25
+
26
+ ##
27
+ # @api public
28
+ def persisted?
29
+ true
30
+ end
31
+
32
+ ##
33
+ # @api public
34
+ def to_param
35
+ @id
36
+ end
37
+
38
+ ##
39
+ # @api public
40
+ def model_name
41
+ @model.model_name
42
+ end
43
+
44
+ ##
45
+ # @api public
46
+ #
47
+ # @note uses the @model's `._to_partial_path` if implemented, otherwise
48
+ # constructs a default
49
+ def to_partial_path
50
+ return @model._to_partial_path if
51
+ @model.respond_to?(:_to_partial_path)
52
+
53
+ "hyrax/#{model_name.collection}/#{model_name.element}"
54
+ end
55
+
56
+ ##
57
+ # @api public
58
+ def to_global_id
59
+ URI::GID.build app: GlobalID.app, model_name: model_name.name, model_id: @id
60
+ end
61
+ end
62
+ end
@@ -8,8 +8,12 @@ module Hyrax
8
8
  def initialize(klass, namespace = nil, name = nil)
9
9
  super
10
10
 
11
- @route_key = Collection.model_name.route_key
12
- @singular_route_key = Collection.model_name.singular_route_key
11
+ @human = 'Collection'
12
+ @i18n_key = :collection
13
+ @param_key = 'collection'
14
+ @plural = 'collections'
15
+ @route_key = 'collections'
16
+ @singular_route_key = 'collection'
13
17
  end
14
18
  end
15
19
  end
@@ -112,16 +112,46 @@ module Hyrax
112
112
  ActiveModel::Type::Boolean.new.cast(ENV.fetch('HYRAX_ANALYTICS', false))
113
113
  end
114
114
 
115
- attr_writer :google_analytics_id
116
- def google_analytics_id
117
- @google_analytics_id ||= nil
115
+ # Currently supports 'google' or 'matomo'
116
+ # google is default for backward compatability
117
+ attr_writer :analytics_provider
118
+ def analytics_provider
119
+ @analytics_provider ||=
120
+ ENV.fetch('HYRAX_ANALYTICS_PROVIDER', 'google')
121
+ end
122
+
123
+ ##
124
+ # @!attribute [w] analytics_start_date
125
+ # @note this can be set using the +ANALITICS_START_DATE+ environment variable (format is YYYY-MM-DD)
126
+ # @return [String] date you wish to start collecting analytics for. used to compute the
127
+ # "all-time" metrics.
128
+ # This is used to compute the "all-time" metrics
129
+ # Set this in your .env file (format is YYYY-MM-DD)
130
+ attr_writer :analytics_start_date
131
+ def analytics_start_date
132
+ @analytics_start_date ||=
133
+ ENV.fetch('ANALYTICS_START_DATE', Time.zone.today - 1.year)
118
134
  end
119
- alias google_analytics_id? google_analytics_id
120
135
 
121
136
  # Defaulting analytic start date to whenever the file was uploaded by leaving it blank
122
137
  attr_writer :analytic_start_date
123
138
  attr_reader :analytic_start_date
124
139
 
140
+ ##
141
+ # @deprecated use analytics_id from config/analytics.yml instead
142
+ def google_analytics_id=(value)
143
+ Deprecation.warn("google_analytics_id is deprecated; use analytics_id from config/analytics.yml instead.")
144
+ Hyrax::Analytics.config.analytics_id = value
145
+ end
146
+
147
+ ##
148
+ # @deprecated use analytics_id from config/analytics.yml instead
149
+ def google_analytics_id
150
+ Deprecation.warn("google_analytics_id is deprecated; use analytics_id from config/analytics.yml instead.")
151
+ Hyrax::Analytics.config.analytics_id
152
+ end
153
+ alias google_analytics_id? google_analytics_id
154
+
125
155
  # @!endgroup
126
156
  # @!group Groups
127
157
 
@@ -385,6 +415,18 @@ module Hyrax
385
415
  # @!endgroup
386
416
  # @!group Valkyrie
387
417
 
418
+ ##
419
+ # @return [Valkyrie::StorageAdapter]
420
+ def branding_storage_adapter
421
+ @branding_storage_adapter ||= Valkyrie::StorageAdapter.find(:branding_disk)
422
+ end
423
+
424
+ ##
425
+ # @param [#to_sym] adapter
426
+ def branding_storage_adapter=(adapter)
427
+ @branding_storage_adapter = Valkyrie::StorageAdapter.find(adapter.to_sym)
428
+ end
429
+
388
430
  ##
389
431
  # @return [#save, #save_all, #delete, #wipe!] an indexing adapter
390
432
  def index_adapter
@@ -442,6 +484,17 @@ module Hyrax
442
484
  # Override characterization runner
443
485
  attr_accessor :characterization_runner
444
486
 
487
+ ##
488
+ # @!attribute [rw] characterization_service
489
+ # @return [#run] the service to use for charactaerization for Valkyrie
490
+ # objects
491
+ # @ see Hyrax::Characterization::ValkyrieCharacterizationService
492
+ attr_writer :characterization_service
493
+ def characterization_service
494
+ @characterization_service ||=
495
+ Hyrax::Characterization::ValkyrieCharacterizationService
496
+ end
497
+
445
498
  # Attributes for the lock manager which ensures a single process/thread is mutating a ore:Aggregation at once.
446
499
  # @!attribute [w] lock_retry_count
447
500
  # How many times to retry to acquire the lock before raising UnableToAcquireLockError
@@ -631,6 +684,14 @@ module Hyrax
631
684
  @show_work_item_rows ||= 10 # rows on show view
632
685
  end
633
686
 
687
+ # This user is logged as the acting user for jobs and other processes that
688
+ # run without being attributed to a specific user (e.g. creation of the
689
+ # default admin set).
690
+ attr_writer :system_user_key
691
+ def system_user_key
692
+ @system_user_key ||= 'systemuser@example.com'
693
+ end
694
+
634
695
  attr_writer :batch_user_key
635
696
  def batch_user_key
636
697
  @batch_user_key ||= 'batchuser@example.com'
@@ -646,6 +707,55 @@ module Hyrax
646
707
  @collection_type_index_field ||= 'collection_type_gid_ssim'
647
708
  end
648
709
 
710
+ attr_writer :collection_model
711
+ ##
712
+ # @return [#constantize] a string representation of the collection
713
+ # model
714
+ def collection_model
715
+ @collection_model ||= '::Collection'
716
+ end
717
+
718
+ ##
719
+ # @return [Class] the configured collection model class
720
+ def collection_class
721
+ collection_model.safe_constantize
722
+ end
723
+
724
+ attr_writer :admin_set_model
725
+ ##
726
+ # @return [#constantize] a string representation of the admin set
727
+ # model
728
+ def admin_set_model
729
+ @admin_set_model ||= 'AdminSet'
730
+ end
731
+
732
+ ##
733
+ # @return [Class] the configured admin set model class
734
+ def admin_set_class
735
+ admin_set_model.constantize
736
+ end
737
+
738
+ ##
739
+ # @return [String] the default admin set id
740
+ def default_admin_set_id
741
+ default_admin_set.id.to_s
742
+ end
743
+
744
+ ##
745
+ # @return [Hyrax::AdministrativeSet] the default admin set
746
+ # @see Hyrax::AdminSetCreateService.find_or_create_default_admin_set
747
+ def default_admin_set
748
+ @default_admin_set ||= Hyrax::AdminSetCreateService.find_or_create_default_admin_set
749
+ end
750
+
751
+ ##
752
+ # If the default admin set is changed, call reset. The next time one of the default
753
+ # admin set configs is checked, the default_admin_set variable will be updated.
754
+ # @see Hyrax::DefaultAdministrativeSet.update
755
+ def reset_default_admin_set
756
+ @default_admin_set = nil
757
+ end
758
+
649
759
  attr_writer :id_field
650
760
  def id_field
651
761
  @id_field || index_field_mapper.id_field
data/lib/hyrax/engine.rb CHANGED
@@ -3,25 +3,27 @@ module Hyrax
3
3
  class Engine < ::Rails::Engine
4
4
  isolate_namespace Hyrax
5
5
 
6
+ require 'almond-rails'
6
7
  require 'awesome_nested_set'
7
8
  require 'breadcrumbs_on_rails'
9
+ require 'clipboard/rails'
8
10
  require 'draper'
9
- require 'dry/struct'
10
11
  require 'dry/equalizer'
11
12
  require 'dry/events'
13
+ require 'dry/struct'
12
14
  require 'dry/validation'
13
- require 'jquery-ui-rails'
15
+ require 'flipflop'
14
16
  require 'flot-rails'
15
- require 'almond-rails'
17
+ require 'hydra-file_characterization'
16
18
  require 'jquery-datatables-rails'
17
- require 'flipflop'
19
+ require 'jquery-ui-rails'
20
+ require 'legato'
18
21
  require 'qa'
19
- require 'clipboard/rails'
20
22
  require 'tinymce-rails'
21
- require 'legato'
22
23
  require 'valkyrie'
23
24
 
24
25
  require 'hydra/derivatives'
26
+ require 'hyrax/active_fedora_dummy_model'
25
27
  require 'hyrax/controller_resource'
26
28
  require 'hyrax/form_fields'
27
29
  require 'hyrax/indexer'
@@ -31,6 +33,7 @@ module Hyrax
31
33
  require 'hyrax/search_state'
32
34
  require 'hyrax/transactions'
33
35
  require 'hyrax/errors'
36
+ require 'hyrax/valkyrie_simple_path_generator'
34
37
 
35
38
  # Force these models to be added to Legato's registry in development mode
36
39
  config.eager_load_paths += %W[
data/lib/hyrax/errors.rb CHANGED
@@ -12,5 +12,7 @@ module Hyrax
12
12
 
13
13
  class SingleUseError < HyraxError; end
14
14
 
15
+ class SingleMembershipError < HyraxError; end
16
+
15
17
  class ObjectNotFoundError < ActiveFedora::ObjectNotFoundError; end
16
18
  end
@@ -49,6 +49,7 @@ module Hyrax
49
49
 
50
50
  form_field_definitions.each do |field_name, options|
51
51
  descendant.property field_name.to_sym, options.merge(display: true, default: [])
52
+ descendant.validates field_name.to_sym, presence: true if options.fetch(:required, false)
52
53
  end
53
54
  end
54
55
  end
@@ -94,6 +94,18 @@ module Hyrax
94
94
  # @macro a_registered_event
95
95
  register_event('batch.created')
96
96
 
97
+ # @since 3.0.0
98
+ # @macro a_registered_event
99
+ register_event('collection.metadata.updated')
100
+
101
+ # @since 3.0.0
102
+ # @macro a_registered_event
103
+ register_event('collection.membership.updated')
104
+
105
+ # @since 3.3.0
106
+ # @macro a_registered_event
107
+ register_event('file.downloaded')
108
+
97
109
  # @since 3.0.0
98
110
  # @macro a_registered_event
99
111
  register_event('file.set.audited')
@@ -129,5 +141,9 @@ module Hyrax
129
141
  # @since 3.0.0
130
142
  # @macro a_registered_event
131
143
  register_event('object.metadata.updated')
144
+
145
+ # @since 3.2.0
146
+ # @macro a_registered_event
147
+ register_event('object.file.uploaded')
132
148
  end
133
149
  end
@@ -7,6 +7,7 @@ module Hyrax
7
7
  class ResourceName < Name
8
8
  def initialize(klass, namespace = nil, name = nil)
9
9
  super
10
+ return unless defined?(Wings::ModelRegistry)
10
11
 
11
12
  legacy_model = Wings::ModelRegistry.lookup(klass)
12
13
  return unless legacy_model
@@ -61,8 +61,8 @@ module Hyrax
61
61
 
62
62
  def build_resources(xml, doc_set)
63
63
  doc_set.each do |doc|
64
- model = doc.fetch('has_model_ssim', []).first.constantize
65
- if model == ::Collection
64
+ model = doc.fetch('has_model_ssim', []).first.safe_constantize
65
+ if model.try(:collection?) || model == Hyrax.config.collection_class
66
66
  build_resource(xml, doc, model, hyrax_routes)
67
67
  else
68
68
  build_resource(xml, doc, model, main_app_routes)
@@ -32,8 +32,8 @@ module Hyrax
32
32
  end
33
33
  end
34
34
 
35
- def build_collections(xml)
36
- ::Collection.search_in_batches(public_access) do |doc_set|
35
+ def build_collections(xml, searcher: AbstractTypeRelation.new(allowable_types: [::Collection, Hyrax.config.collection_class]))
36
+ searcher.search_in_batches(public_access) do |doc_set|
37
37
  build_resources(xml, doc_set, hyrax_routes)
38
38
  end
39
39
  end
@@ -15,9 +15,9 @@ require 'capybara/rspec'
15
15
  require 'capybara/rails'
16
16
  require 'capybara-screenshot/rspec'
17
17
  require 'selenium-webdriver'
18
- require 'webdrivers'
18
+ require 'webdrivers' unless ENV['IN_DOCKER'].present? || ENV['HUB_URL'].present?
19
19
 
20
- if ENV['IN_DOCKER'].present?
20
+ if ENV['IN_DOCKER'].present? || ENV['HUB_URL'].present?
21
21
  args = %w[disable-gpu no-sandbox whitelisted-ips window-size=1400,1400]
22
22
  args.push('headless') if ActiveModel::Type::Boolean.new.cast(ENV['CHROME_HEADLESS_MODE'])
23
23
 
@@ -40,7 +40,9 @@ if ENV['IN_DOCKER'].present?
40
40
 
41
41
  Capybara.server_host = '0.0.0.0'
42
42
  Capybara.server_port = 3010
43
- Capybara.app_host = ENV['CAPYBARA_SERVER'] || 'http://127.0.0.1:3010'
43
+
44
+ ip = IPSocket.getaddress(Socket.gethostname)
45
+ Capybara.app_host = "http://#{ip}:#{Capybara.server_port}"
44
46
  else
45
47
  TEST_HOST = 'localhost:3000'.freeze
46
48
  # @note In January 2018, TravisCI disabled Chrome sandboxing in its Linux
@@ -152,6 +152,8 @@ end
152
152
  RSpec.shared_examples 'a Hyrax::AdministrativeSet' do
153
153
  subject(:admin_set) { described_class.new }
154
154
 
155
+ it_behaves_like 'a model with core metadata'
156
+
155
157
  it 'has an #alternative_title' do
156
158
  expect { admin_set.alternative_title = ['Moomin'] }
157
159
  .to change { admin_set.alternative_title }
@@ -188,5 +188,11 @@ RSpec.shared_examples 'a Collection indexer' do
188
188
  expect(indexer.to_solr)
189
189
  .to include(thumbnail_path_ss: include('assets/collection', '.png'))
190
190
  end
191
+
192
+ it 'indexes depositor' do
193
+ expect(indexer.to_solr)
194
+ .to include(depositor_ssim: [resource.depositor],
195
+ depositor_tesim: [resource.depositor])
196
+ end
191
197
  end
192
198
  end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.shared_examples 'a Valkyrie::StorageAdapter with versioning support' do
4
+ describe '#supports?' do
5
+ it 'supports versions' do
6
+ expect(storage_adapter.supports?(:versions)).to eq true
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+ require 'hyrax/transactions/transaction'
3
+
4
+ module Hyrax
5
+ module Transactions
6
+ ##
7
+ # Creates a Hyrax::AdministrativeSet from a ChangeSet
8
+ #
9
+ # @since 3.2.0
10
+ class AdminSetCreate < Transaction
11
+ DEFAULT_STEPS = ['change_set.apply',
12
+ 'admin_set_resource.apply_collection_type_permissions',
13
+ 'admin_set_resource.save_acl'].freeze
14
+
15
+ ##
16
+ # @see Hyrax::Transactions::Transaction
17
+ def initialize(container: Container, steps: DEFAULT_STEPS)
18
+ super
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+ require 'hyrax/transactions/transaction'
3
+
4
+ module Hyrax
5
+ module Transactions
6
+ ##
7
+ # Creates a Collection from a ChangeSet
8
+ #
9
+ # @since 3.2.0
10
+ class CollectionCreate < Transaction
11
+ DEFAULT_STEPS = ['change_set.set_user_as_depositor',
12
+ 'change_set.set_collection_type_gid',
13
+ 'change_set.add_to_collections',
14
+ 'change_set.apply',
15
+ 'collection_resource.apply_collection_type_permissions',
16
+ 'collection_resource.save_acl'].freeze
17
+
18
+ ##
19
+ # @see Hyrax::Transactions::Transaction
20
+ def initialize(container: Container, steps: DEFAULT_STEPS)
21
+ super
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+ require 'hyrax/transactions/transaction'
3
+
4
+ module Hyrax
5
+ module Transactions
6
+ ##
7
+ # Creates a Collection from a ChangeSet
8
+ #
9
+ # @since 3.2.0
10
+ class CollectionUpdate < Transaction
11
+ DEFAULT_STEPS = ['change_set.apply'].freeze
12
+
13
+ ##
14
+ # @see Hyrax::Transactions::Transaction
15
+ def initialize(container: Container, steps: DEFAULT_STEPS)
16
+ super
17
+ end
18
+ end
19
+ end
20
+ end
@@ -18,21 +18,29 @@ module Hyrax
18
18
  #
19
19
  # @see https://dry-rb.org/gems/dry-container/
20
20
  class Container # rubocop:disable Metrics/ClassLength
21
+ require 'hyrax/transactions/admin_set_create'
21
22
  require 'hyrax/transactions/apply_change_set'
23
+ require 'hyrax/transactions/collection_create'
24
+ require 'hyrax/transactions/collection_update'
22
25
  require 'hyrax/transactions/create_work'
23
26
  require 'hyrax/transactions/destroy_work'
27
+ require 'hyrax/transactions/file_set_destroy'
24
28
  require 'hyrax/transactions/work_create'
25
29
  require 'hyrax/transactions/work_destroy'
26
30
  require 'hyrax/transactions/update_work'
27
31
  require 'hyrax/transactions/steps/add_file_sets'
28
32
  require 'hyrax/transactions/steps/add_to_collections'
33
+ require 'hyrax/transactions/steps/add_to_parent'
29
34
  require 'hyrax/transactions/steps/apply_collection_permission_template'
35
+ require 'hyrax/transactions/steps/apply_collection_type_permissions'
30
36
  require 'hyrax/transactions/steps/apply_permission_template'
31
37
  require 'hyrax/transactions/steps/apply_visibility'
32
38
  require 'hyrax/transactions/steps/delete_resource'
33
39
  require 'hyrax/transactions/steps/destroy_work'
34
40
  require 'hyrax/transactions/steps/ensure_admin_set'
41
+ require 'hyrax/transactions/steps/set_collection_type_gid'
35
42
  require 'hyrax/transactions/steps/ensure_permission_template'
43
+ require 'hyrax/transactions/steps/remove_file_set_from_work'
36
44
  require 'hyrax/transactions/steps/save'
37
45
  require 'hyrax/transactions/steps/save_work'
38
46
  require 'hyrax/transactions/steps/save_access_control'
@@ -55,6 +63,14 @@ module Hyrax
55
63
  ApplyChangeSet.new
56
64
  end
57
65
 
66
+ ops.register 'create_collection' do
67
+ CollectionCreate.new
68
+ end
69
+
70
+ ops.register 'update_collection' do
71
+ CollectionUpdate.new
72
+ end
73
+
58
74
  ops.register 'create_work' do
59
75
  WorkCreate.new
60
76
  end
@@ -67,6 +83,10 @@ module Hyrax
67
83
  Steps::Save.new
68
84
  end
69
85
 
86
+ ops.register 'set_collection_type_gid' do
87
+ Steps::SetCollectionTypeGid.new
88
+ end
89
+
70
90
  ops.register 'set_default_admin_set' do
71
91
  Steps::SetDefaultAdminSet.new
72
92
  end
@@ -92,11 +112,49 @@ module Hyrax
92
112
  end
93
113
  end
94
114
 
115
+ namespace 'file_set' do |ops| # Hyrax::FileSet
116
+ ops.register 'delete' do
117
+ Steps::DeleteResource.new
118
+ end
119
+
120
+ ops.register 'destroy' do
121
+ FileSetDestroy.new
122
+ end
123
+
124
+ ops.register 'remove_from_work' do
125
+ Steps::RemoveFileSetFromWork.new
126
+ end
127
+ end
128
+
129
+ namespace 'admin_set_resource' do |ops| # valkyrie administrative set
130
+ ops.register 'apply_collection_type_permissions' do
131
+ Steps::ApplyCollectionTypePermissions.new
132
+ end
133
+
134
+ ops.register 'save_acl' do
135
+ Steps::SaveAccessControl.new
136
+ end
137
+ end
138
+
139
+ namespace 'collection_resource' do |ops| # valkyrie collection
140
+ ops.register 'apply_collection_type_permissions' do
141
+ Steps::ApplyCollectionTypePermissions.new
142
+ end
143
+
144
+ ops.register 'save_acl' do
145
+ Steps::SaveAccessControl.new
146
+ end
147
+ end
148
+
95
149
  namespace 'work_resource' do |ops| # valkyrie works
96
150
  ops.register 'add_file_sets' do
97
151
  Steps::AddFileSets.new
98
152
  end
99
153
 
154
+ ops.register 'add_to_parent' do
155
+ Steps::AddToParent.new
156
+ end
157
+
100
158
  ops.register 'delete' do
101
159
  Steps::DeleteResource.new
102
160
  end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+ require 'hyrax/transactions/transaction'
3
+
4
+ module Hyrax
5
+ module Transactions
6
+ ##
7
+ # destroys a FileSet resource.
8
+ #
9
+ # @since 3.1.0
10
+ class FileSetDestroy < Transaction
11
+ DEFAULT_STEPS = ['file_set.remove_from_work',
12
+ 'file_set.delete'].freeze
13
+
14
+ ##
15
+ # @see Hyrax::Transactions::Transaction
16
+ def initialize(container: Container, steps: DEFAULT_STEPS)
17
+ super
18
+ end
19
+ end
20
+ end
21
+ end
@@ -20,10 +20,11 @@ module Hyrax
20
20
  ##
21
21
  # @param [Hyrax::Work] obj
22
22
  # @param [Enumerable<UploadedFile>] uploaded_files
23
+ # @param [Enumerable<Hash>] file_set_params
23
24
  #
24
25
  # @return [Dry::Monads::Result]
25
- def call(obj, uploaded_files: [])
26
- if @handler.new(work: obj).add(files: uploaded_files).attach
26
+ def call(obj, uploaded_files: [], file_set_params: [])
27
+ if @handler.new(work: obj).add(files: uploaded_files, file_set_params: file_set_params).attach
27
28
  Success(obj)
28
29
  else
29
30
  Failure[:failed_to_attach_file_sets, uploaded_files]