hyrax 3.0.0.pre.rc2 → 3.0.0.pre.rc3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (514) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +5 -5
  3. data/.dassie/.env +4 -0
  4. data/.dassie/.gitignore +27 -0
  5. data/.dassie/Gemfile +57 -0
  6. data/.dassie/README.md +3 -0
  7. data/.dassie/Rakefile +6 -0
  8. data/.dassie/app/actors/hyrax/actors/generic_work_actor.rb +8 -0
  9. data/.dassie/app/actors/hyrax/actors/namespaced_works/nested_work_actor.rb +8 -0
  10. data/.dassie/app/assets/config/manifest.js +3 -0
  11. data/.dassie/app/assets/images/.keep +0 -0
  12. data/.dassie/app/assets/images/unauthorized.png +0 -0
  13. data/.dassie/app/assets/images/us_404.svg +91 -0
  14. data/.dassie/app/assets/javascripts/application.js +26 -0
  15. data/.dassie/app/assets/javascripts/blacklight_gallery.js +1 -0
  16. data/.dassie/app/assets/javascripts/cable.js +13 -0
  17. data/.dassie/app/assets/javascripts/channels/.keep +0 -0
  18. data/.dassie/app/assets/javascripts/openseadragon.js +2 -0
  19. data/.dassie/app/assets/stylesheets/application.css +16 -0
  20. data/.dassie/app/assets/stylesheets/hyrax.scss +17 -0
  21. data/.dassie/app/assets/stylesheets/openseadragon.css +3 -0
  22. data/.dassie/app/channels/application_cable/channel.rb +4 -0
  23. data/.dassie/app/channels/application_cable/connection.rb +4 -0
  24. data/.dassie/app/controllers/application_controller.rb +14 -0
  25. data/.dassie/app/controllers/catalog_controller.rb +300 -0
  26. data/.dassie/app/controllers/concerns/.keep +0 -0
  27. data/.dassie/app/controllers/hyrax/generic_works_controller.rb +14 -0
  28. data/.dassie/app/controllers/hyrax/monographs_controller.rb +17 -0
  29. data/.dassie/app/controllers/hyrax/namespaced_works/nested_works_controller.rb +14 -0
  30. data/.dassie/app/forms/hyrax/generic_work_form.rb +9 -0
  31. data/.dassie/app/forms/hyrax/namespaced_works/nested_work_form.rb +9 -0
  32. data/.dassie/app/forms/monograph_form.rb +20 -0
  33. data/.dassie/app/helpers/application_helper.rb +2 -0
  34. data/.dassie/app/helpers/hyrax_helper.rb +6 -0
  35. data/.dassie/app/indexers/generic_work_indexer.rb +18 -0
  36. data/.dassie/app/indexers/monograph_indexer.rb +16 -0
  37. data/.dassie/app/indexers/namespaced_works/nested_work_indexer.rb +18 -0
  38. data/.dassie/app/jobs/application_job.rb +2 -0
  39. data/.dassie/app/mailers/application_mailer.rb +4 -0
  40. data/.dassie/app/models/ability.rb +21 -0
  41. data/.dassie/app/models/application_record.rb +3 -0
  42. data/.dassie/app/models/collection.rb +8 -0
  43. data/.dassie/app/models/concerns/.keep +0 -0
  44. data/.dassie/app/models/file_set.rb +5 -0
  45. data/.dassie/app/models/generic_work.rb +14 -0
  46. data/.dassie/app/models/monograph.rb +8 -0
  47. data/.dassie/app/models/namespaced_works/nested_work.rb +16 -0
  48. data/.dassie/app/models/qa.rb +5 -0
  49. data/.dassie/app/models/qa/local_authority.rb +2 -0
  50. data/.dassie/app/models/qa/local_authority_entry.rb +3 -0
  51. data/.dassie/app/models/search_builder.rb +16 -0
  52. data/.dassie/app/models/solr_document.rb +28 -0
  53. data/.dassie/app/models/time_span.rb +22 -0
  54. data/.dassie/app/models/user.rb +26 -0
  55. data/.dassie/app/presenters/hyrax/generic_work_presenter.rb +6 -0
  56. data/.dassie/app/presenters/hyrax/namespaced_works/nested_work_presenter.rb +6 -0
  57. data/.dassie/app/views/hyrax/generic_works/_generic_work.html.erb +2 -0
  58. data/.dassie/app/views/hyrax/monographs/_monograph.html.erb +2 -0
  59. data/.dassie/app/views/hyrax/namespaced_works/nested_works/_nested_work.html.erb +2 -0
  60. data/.dassie/app/views/layouts/application.html.erb +15 -0
  61. data/.dassie/app/views/layouts/mailer.html.erb +13 -0
  62. data/.dassie/app/views/layouts/mailer.text.erb +1 -0
  63. data/.dassie/bin/bundle +3 -0
  64. data/.dassie/bin/rails +9 -0
  65. data/.dassie/bin/rake +9 -0
  66. data/.dassie/bin/setup +36 -0
  67. data/.dassie/bin/spring +17 -0
  68. data/.dassie/bin/update +31 -0
  69. data/.dassie/bin/yarn +11 -0
  70. data/.dassie/config.ru +5 -0
  71. data/.dassie/config/analytics.yml +6 -0
  72. data/.dassie/config/application.rb +22 -0
  73. data/.dassie/config/arkivo.yml +6 -0
  74. data/.dassie/config/authorities/licenses.yml +46 -0
  75. data/.dassie/config/authorities/resource_types.yml +41 -0
  76. data/.dassie/config/authorities/rights_statements.yml +37 -0
  77. data/.dassie/config/blacklight.yml +9 -0
  78. data/.dassie/config/boot.rb +4 -0
  79. data/.dassie/config/browse_everything_providers.yml +2 -0
  80. data/.dassie/config/cable.yml +10 -0
  81. data/.dassie/config/credentials.yml.enc +1 -0
  82. data/.dassie/config/environment.rb +5 -0
  83. data/.dassie/config/environments/development.rb +69 -0
  84. data/.dassie/config/environments/production.rb +94 -0
  85. data/.dassie/config/environments/test.rb +51 -0
  86. data/.dassie/config/fedora.yml +15 -0
  87. data/.dassie/config/initializers/arkivo_constraint.rb +12 -0
  88. data/.dassie/config/initializers/assets.rb +2 -0
  89. data/.dassie/config/initializers/clamav.rb +2 -0
  90. data/.dassie/config/initializers/cookies_serializer.rb +1 -0
  91. data/.dassie/config/initializers/devise.rb +13 -0
  92. data/.dassie/config/initializers/filter_parameter_logging.rb +1 -0
  93. data/.dassie/config/initializers/hydra_config.rb +6 -0
  94. data/.dassie/config/initializers/hyrax.rb +48 -0
  95. data/.dassie/config/initializers/mailboxer.rb +21 -0
  96. data/.dassie/config/initializers/mime_types.rb +4 -0
  97. data/.dassie/config/initializers/mini_magick.rb +6 -0
  98. data/.dassie/config/initializers/redis_config.rb +4 -0
  99. data/.dassie/config/initializers/riiif.rb +27 -0
  100. data/.dassie/config/initializers/simple_form.rb +28 -0
  101. data/.dassie/config/initializers/simple_form_bootstrap.rb +143 -0
  102. data/.dassie/config/initializers/wrap_parameters.rb +3 -0
  103. data/.dassie/config/locales/blacklight.en.yml +3 -0
  104. data/.dassie/config/locales/devise.en.yml +65 -0
  105. data/.dassie/config/locales/generic_work.de.yml +8 -0
  106. data/.dassie/config/locales/generic_work.en.yml +8 -0
  107. data/.dassie/config/locales/generic_work.es.yml +10 -0
  108. data/.dassie/config/locales/generic_work.fr.yml +8 -0
  109. data/.dassie/config/locales/generic_work.it.yml +8 -0
  110. data/.dassie/config/locales/generic_work.pt-BR.yml +8 -0
  111. data/.dassie/config/locales/generic_work.zh.yml +10 -0
  112. data/.dassie/config/locales/hyrax.de.yml +58 -0
  113. data/.dassie/config/locales/hyrax.en.yml +58 -0
  114. data/.dassie/config/locales/hyrax.es.yml +58 -0
  115. data/.dassie/config/locales/hyrax.fr.yml +58 -0
  116. data/.dassie/config/locales/hyrax.it.yml +58 -0
  117. data/.dassie/config/locales/hyrax.pt-BR.yml +58 -0
  118. data/.dassie/config/locales/hyrax.zh.yml +58 -0
  119. data/.dassie/config/locales/namespaced_works/nested_work.de.yml +8 -0
  120. data/.dassie/config/locales/namespaced_works/nested_work.en.yml +8 -0
  121. data/.dassie/config/locales/namespaced_works/nested_work.es.yml +10 -0
  122. data/.dassie/config/locales/namespaced_works/nested_work.fr.yml +8 -0
  123. data/.dassie/config/locales/namespaced_works/nested_work.it.yml +8 -0
  124. data/.dassie/config/locales/namespaced_works/nested_work.pt-BR.yml +8 -0
  125. data/.dassie/config/locales/namespaced_works/nested_work.zh.yml +10 -0
  126. data/.dassie/config/metadata/monograph.yaml +55 -0
  127. data/.dassie/config/metadata/sample_metadata.yaml +3 -0
  128. data/.dassie/config/puma.rb +6 -0
  129. data/.dassie/config/redis.yml +9 -0
  130. data/.dassie/config/role_map.yml +24 -0
  131. data/.dassie/config/routes.rb +35 -0
  132. data/.dassie/config/solr.yml +7 -0
  133. data/.dassie/config/spring.rb +6 -0
  134. data/.dassie/config/storage.yml +7 -0
  135. data/.dassie/config/tinymce.yml +12 -0
  136. data/.dassie/config/uv/uv-config.json +3 -0
  137. data/.dassie/config/uv/uv.html +87 -0
  138. data/.dassie/config/valkyrie_index.yml +12 -0
  139. data/.dassie/config/workflows/default_workflow.json +21 -0
  140. data/.dassie/config/workflows/mediated_deposit_workflow.json +76 -0
  141. data/.dassie/config/zotero.yml +6 -0
  142. data/.dassie/db/migrate/20200821212749_create_searches.blacklight.rb +17 -0
  143. data/.dassie/db/migrate/20200821212750_create_bookmarks.blacklight.rb +19 -0
  144. data/.dassie/db/migrate/20200821212751_add_polymorphic_type_to_bookmarks.blacklight.rb +9 -0
  145. data/.dassie/db/migrate/20200821212803_devise_create_users.rb +44 -0
  146. data/.dassie/db/migrate/20200821212806_add_devise_guests_to_users.rb +15 -0
  147. data/.dassie/db/migrate/20200821212828_create_version_committers.hyrax.rb +15 -0
  148. data/.dassie/db/migrate/20200821212829_create_checksum_audit_logs.hyrax.rb +19 -0
  149. data/.dassie/db/migrate/20200821212830_create_single_use_links.hyrax.rb +12 -0
  150. data/.dassie/db/migrate/20200821212831_add_social_to_users.hyrax.rb +13 -0
  151. data/.dassie/db/migrate/20200821212832_add_ldap_attrs_to_user.hyrax.rb +27 -0
  152. data/.dassie/db/migrate/20200821212833_add_avatars_to_users.hyrax.rb +15 -0
  153. data/.dassie/db/migrate/20200821212834_create_trophies.hyrax.rb +10 -0
  154. data/.dassie/db/migrate/20200821212835_add_linkedin_to_users.hyrax.rb +5 -0
  155. data/.dassie/db/migrate/20200821212836_create_tinymce_assets.hyrax.rb +8 -0
  156. data/.dassie/db/migrate/20200821212837_create_content_blocks.hyrax.rb +10 -0
  157. data/.dassie/db/migrate/20200821212838_create_featured_works.hyrax.rb +12 -0
  158. data/.dassie/db/migrate/20200821212839_add_external_key_to_content_blocks.hyrax.rb +6 -0
  159. data/.dassie/db/migrate/20200821212840_create_proxy_deposit_rights.hyrax.rb +10 -0
  160. data/.dassie/db/migrate/20200821212841_create_proxy_deposit_requests.hyrax.rb +15 -0
  161. data/.dassie/db/migrate/20200821212842_create_file_view_stats.hyrax.rb +12 -0
  162. data/.dassie/db/migrate/20200821212843_create_file_download_stats.hyrax.rb +12 -0
  163. data/.dassie/db/migrate/20200821212844_add_orcid_to_users.hyrax.rb +5 -0
  164. data/.dassie/db/migrate/20200821212845_create_user_stats.hyrax.rb +19 -0
  165. data/.dassie/db/migrate/20200821212846_create_work_view_stats.hyrax.rb +12 -0
  166. data/.dassie/db/migrate/20200821212847_add_works_to_user_stats.hyrax.rb +13 -0
  167. data/.dassie/db/migrate/20200821212848_change_trophy_generic_file_id_to_work_id.hyrax.rb +5 -0
  168. data/.dassie/db/migrate/20200821212849_change_proxy_deposit_generic_file_id_to_work_id.hyrax.rb +5 -0
  169. data/.dassie/db/migrate/20200821212850_change_audit_log_generic_file_id_to_file_set_id.hyrax.rb +5 -0
  170. data/.dassie/db/migrate/20200821212851_change_proxy_deposit_request_generic_file_id_to_work_id.hyrax.rb +5 -0
  171. data/.dassie/db/migrate/20200821212852_create_uploaded_files.hyrax.rb +10 -0
  172. data/.dassie/db/migrate/20200821212853_create_features.hyrax.rb +10 -0
  173. data/.dassie/db/migrate/20200821212854_create_operations.hyrax.rb +23 -0
  174. data/.dassie/db/migrate/20200821212855_change_featured_work_generic_file_id_to_work_id.hyrax.rb +6 -0
  175. data/.dassie/db/migrate/20200821212856_add_arkivo_to_users.hyrax.rb +8 -0
  176. data/.dassie/db/migrate/20200821212857_create_sipity.hyrax.rb +163 -0
  177. data/.dassie/db/migrate/20200821212858_create_sipity_workflow_methods.hyrax.rb +10 -0
  178. data/.dassie/db/migrate/20200821212859_create_permission_template.hyrax.rb +11 -0
  179. data/.dassie/db/migrate/20200821212860_create_permission_template_access.hyrax.rb +11 -0
  180. data/.dassie/db/migrate/20200821212861_add_release_to_permission_templates.hyrax.rb +6 -0
  181. data/.dassie/db/migrate/20200821212862_add_permission_template_to_sipity_workflow.hyrax.rb +26 -0
  182. data/.dassie/db/migrate/20200821212863_tidy_up_because_of_bad_exception.hyrax.rb +13 -0
  183. data/.dassie/db/migrate/20200821212864_add_allows_access_grant_to_workflow.hyrax.rb +5 -0
  184. data/.dassie/db/migrate/20200821212865_change_checksum_audit_log.hyrax.rb +18 -0
  185. data/.dassie/db/migrate/20200821212866_create_job_io_wrappers.hyrax.rb +15 -0
  186. data/.dassie/db/migrate/20200821212867_create_collection_types.hyrax.rb +17 -0
  187. data/.dassie/db/migrate/20200821212868_update_collection_type_column_names.hyrax.rb +9 -0
  188. data/.dassie/db/migrate/20200821212869_update_collection_type_column_options.hyrax.rb +17 -0
  189. data/.dassie/db/migrate/20200821212870_create_collection_branding_infos.hyrax.rb +15 -0
  190. data/.dassie/db/migrate/20200821212871_create_collection_type_participants.hyrax.rb +11 -0
  191. data/.dassie/db/migrate/20200821212872_rename_admin_set_id_to_source_id.hyrax.rb +5 -0
  192. data/.dassie/db/migrate/20200821212873_add_preferred_locale_to_users.hyrax.rb +5 -0
  193. data/.dassie/db/migrate/20200821212874_add_collection_type_sharing_options.hyrax.rb +5 -0
  194. data/.dassie/db/migrate/20200821212875_add_unique_constraint_to_permission_template_accesses.hyrax.rb +8 -0
  195. data/.dassie/db/migrate/20200821212876_add_branding_to_collection_type.hyrax.rb +5 -0
  196. data/.dassie/db/migrate/20200821212877_add_badge_color_to_collection_types.hyrax.rb +5 -0
  197. data/.dassie/db/migrate/20200821212878_update_single_use_links_column_names.hyrax.rb +6 -0
  198. data/.dassie/db/migrate/20200821212879_change_sipity_entity_specific_responsibility.hyrax.rb +9 -0
  199. data/.dassie/db/migrate/20200821212880_create_mailboxer.mailboxer_engine.rb +65 -0
  200. data/.dassie/db/migrate/20200821212881_add_conversation_optout.mailboxer_engine.rb +15 -0
  201. data/.dassie/db/migrate/20200821212882_add_missing_indices.mailboxer_engine.rb +20 -0
  202. data/.dassie/db/migrate/20200821212883_add_delivery_tracking_info_to_mailboxer_receipts.mailboxer_engine.rb +8 -0
  203. data/.dassie/db/migrate/20200821212884_create_qa_local_authorities.rb +10 -0
  204. data/.dassie/db/migrate/20200821212885_create_qa_local_authority_entries.rb +12 -0
  205. data/.dassie/db/migrate/20200821212902_create_minter_states.noid_rails_engine.rb +17 -0
  206. data/.dassie/db/migrate/20200821212903_rename_minter_state_random_to_rand.noid_rails_engine.rb +8 -0
  207. data/.dassie/db/schema.rb +563 -0
  208. data/.dassie/db/seeds.rb +14 -0
  209. data/.dassie/lib/assets/.keep +0 -0
  210. data/.dassie/lib/tasks/.keep +0 -0
  211. data/.dassie/log/.keep +0 -0
  212. data/.dassie/package.json +17 -0
  213. data/.dassie/public/404.html +67 -0
  214. data/.dassie/public/422.html +67 -0
  215. data/.dassie/public/500.html +66 -0
  216. data/.dassie/public/apple-touch-icon-precomposed.png +0 -0
  217. data/.dassie/public/apple-touch-icon.png +0 -0
  218. data/.dassie/public/favicon.ico +0 -0
  219. data/.dassie/public/robots.txt +1 -0
  220. data/.dassie/solr/conf/_rest_managed.json +3 -0
  221. data/.dassie/solr/conf/mapping-ISOLatin1Accent.txt +246 -0
  222. data/.dassie/solr/conf/schema.xml +367 -0
  223. data/.dassie/solr/conf/scripts.conf +24 -0
  224. data/.dassie/solr/conf/solrconfig.xml +208 -0
  225. data/.dassie/solr/conf/stopwords.txt +58 -0
  226. data/.dassie/solr/conf/stopwords_en.txt +58 -0
  227. data/.dassie/solr/conf/xslt/example.xsl +132 -0
  228. data/.dassie/solr/conf/xslt/example_atom.xsl +67 -0
  229. data/.dassie/solr/conf/xslt/example_rss.xsl +66 -0
  230. data/.dassie/solr/conf/xslt/luke.xsl +337 -0
  231. data/.dassie/solr/sample_solr_documents.yml +2692 -0
  232. data/.dassie/storage/.keep +0 -0
  233. data/.dassie/values.stage.yaml +7 -0
  234. data/.dassie/values.yaml +15 -0
  235. data/.dassie/vendor/.keep +0 -0
  236. data/.dockerignore +11 -0
  237. data/.env +26 -0
  238. data/.github/CODE_OF_CONDUCT.md +4 -4
  239. data/.github/CONTRIBUTING.md +1 -1
  240. data/.github/SUPPORT.md +13 -1
  241. data/.gitignore +1 -1
  242. data/.regen +1 -1
  243. data/.rubocop.yml +1 -0
  244. data/.rubocop_fixme.yml +4 -0
  245. data/CODE_OF_CONDUCT.md +4 -4
  246. data/CONTAINERS.md +148 -0
  247. data/CONTRIBUTING.md +1 -1
  248. data/Dockerfile +75 -0
  249. data/Gemfile +26 -35
  250. data/README.md +61 -288
  251. data/app/actors/hyrax/actors/attach_members_actor.rb +7 -5
  252. data/app/actors/hyrax/actors/base_actor.rb +0 -1
  253. data/app/actors/hyrax/actors/create_with_files_ordered_members_actor.rb +28 -28
  254. data/app/actors/hyrax/actors/create_with_remote_files_actor.rb +2 -3
  255. data/app/actors/hyrax/actors/create_with_remote_files_ordered_members_actor.rb +23 -28
  256. data/app/actors/hyrax/actors/default_admin_set_actor.rb +20 -21
  257. data/app/actors/hyrax/actors/file_actor.rb +32 -32
  258. data/app/actors/hyrax/actors/file_set_actor.rb +4 -15
  259. data/app/actors/hyrax/actors/initialize_workflow_actor.rb +8 -0
  260. data/app/actors/hyrax/actors/transfer_request_actor.rb +5 -0
  261. data/app/assets/javascripts/hyrax.js +1 -0
  262. data/app/assets/javascripts/hyrax/skip_to_content.js +15 -0
  263. data/app/assets/stylesheets/hyrax/_usage-stats.scss +1 -1
  264. data/app/authorities/qa/authorities/collections.rb +18 -8
  265. data/app/authorities/qa/authorities/find_works.rb +20 -5
  266. data/app/controllers/concerns/hyrax/collections_controller_behavior.rb +15 -6
  267. data/app/controllers/concerns/hyrax/works_controller_behavior.rb +62 -31
  268. data/app/controllers/hyrax/dashboard/collections_controller.rb +22 -12
  269. data/app/controllers/hyrax/dashboard/works_controller.rb +3 -4
  270. data/app/controllers/hyrax/file_sets_controller.rb +19 -10
  271. data/app/controllers/hyrax/homepage_controller.rb +11 -11
  272. data/app/controllers/hyrax/my/collections_controller.rb +5 -6
  273. data/app/controllers/hyrax/my/highlights_controller.rb +2 -3
  274. data/app/controllers/hyrax/my/shares_controller.rb +2 -3
  275. data/app/controllers/hyrax/my/works_controller.rb +1 -6
  276. data/app/controllers/hyrax/my_controller.rb +10 -2
  277. data/app/controllers/hyrax/permissions_controller.rb +1 -0
  278. data/app/controllers/hyrax/single_use_links_viewer_controller.rb +11 -5
  279. data/app/controllers/hyrax/users_controller.rb +5 -10
  280. data/app/forms/hyrax/forms/failed_submission_form_wrapper.rb +136 -0
  281. data/app/forms/hyrax/forms/resource_form.rb +8 -4
  282. data/app/helpers/hyrax/collections_helper.rb +1 -1
  283. data/app/helpers/hyrax/dashboard_helper_behavior.rb +7 -2
  284. data/app/helpers/hyrax/embargo_helper.rb +5 -1
  285. data/app/helpers/hyrax/hyrax_helper_behavior.rb +10 -5
  286. data/app/helpers/hyrax/lease_helper.rb +5 -1
  287. data/app/indexers/hyrax/pcdm_collection_indexer.rb +21 -0
  288. data/app/indexers/hyrax/resource_indexer.rb +3 -1
  289. data/app/indexers/hyrax/valkyrie_collection_indexer.rb +3 -12
  290. data/app/indexers/hyrax/valkyrie_indexer.rb +45 -17
  291. data/app/indexers/hyrax/valkyrie_work_indexer.rb +16 -0
  292. data/app/jobs/attach_files_to_work_job.rb +3 -41
  293. data/app/jobs/embargo_expiry_job.rb +15 -0
  294. data/app/jobs/event_job.rb +14 -7
  295. data/app/jobs/hyrax/application_job.rb +6 -1
  296. data/app/jobs/import_url_job.rb +11 -5
  297. data/app/jobs/inherit_permissions_job.rb +6 -25
  298. data/app/jobs/lease_expiry_job.rb +15 -0
  299. data/app/models/admin_set.rb +1 -1
  300. data/app/models/concerns/hyrax/ability.rb +192 -21
  301. data/app/models/concerns/hyrax/ability/admin_set_ability.rb +0 -5
  302. data/app/models/concerns/hyrax/collection_behavior.rb +7 -13
  303. data/app/models/concerns/hyrax/permissions/writable.rb +2 -2
  304. data/app/models/concerns/hyrax/solr_document/characterization.rb +35 -2
  305. data/app/models/concerns/hyrax/solr_document_behavior.rb +37 -5
  306. data/app/models/hyrax/change_set.rb +5 -1
  307. data/app/models/hyrax/collection_type.rb +59 -22
  308. data/app/models/hyrax/event.rb +5 -7
  309. data/app/models/hyrax/file_metadata.rb +15 -4
  310. data/app/models/hyrax/pcdm_collection.rb +13 -0
  311. data/app/models/hyrax/uploaded_file.rb +9 -2
  312. data/app/models/hyrax/{active_job_proxy.rb → valkyrie_global_id_proxy.rb} +6 -5
  313. data/app/models/hyrax/virus_scanner.rb +2 -1
  314. data/app/models/hyrax/work.rb +1 -1
  315. data/app/models/sipity.rb +6 -0
  316. data/app/models/sipity/entity.rb +1 -1
  317. data/app/models/sipity/workflow.rb +23 -3
  318. data/app/presenters/hyrax/admin/repository_object_presenter.rb +7 -2
  319. data/app/presenters/hyrax/collection_presenter.rb +1 -1
  320. data/app/presenters/hyrax/file_set_presenter.rb +3 -0
  321. data/app/presenters/hyrax/iiif_manifest_presenter.rb +3 -3
  322. data/app/presenters/hyrax/permission_badge.rb +1 -1
  323. data/app/presenters/hyrax/presenter_factory.rb +0 -2
  324. data/app/presenters/hyrax/select_collection_type_presenter.rb +16 -3
  325. data/app/presenters/hyrax/select_type_presenter.rb +3 -2
  326. data/app/presenters/hyrax/stats_usage_presenter.rb +0 -1
  327. data/app/presenters/hyrax/work_show_presenter.rb +1 -1
  328. data/app/renderers/hyrax/renderers/attribute_renderer.rb +16 -6
  329. data/app/search_builders/hyrax/README.md +3 -3
  330. data/app/search_builders/hyrax/admin_admin_set_member_search_builder.rb +8 -2
  331. data/app/search_builders/hyrax/collection_member_search_builder.rb +21 -7
  332. data/app/search_builders/hyrax/dashboard/managed_search_filters.rb +1 -1
  333. data/app/search_builders/hyrax/dashboard/nested_collections_search_builder.rb +1 -1
  334. data/app/search_builders/hyrax/embargo_search_builder.rb +0 -1
  335. data/app/search_builders/hyrax/filter_by_type.rb +3 -1
  336. data/app/search_builders/hyrax/lease_search_builder.rb +0 -1
  337. data/app/search_builders/hyrax/nested_collections_parent_search_builder.rb +12 -2
  338. data/app/search_builders/hyrax/search_builder.rb +1 -4
  339. data/app/search_builders/hyrax/search_filters.rb +0 -2
  340. data/app/services/hyrax/access_control_list.rb +33 -2
  341. data/app/services/hyrax/adapters/nesting_index_adapter.rb +26 -7
  342. data/app/services/hyrax/admin_set_member_service.rb +18 -4
  343. data/{lib/hyrax/callbacks/registry.rb → app/services/hyrax/callbacks.rb} +23 -0
  344. data/app/services/hyrax/change_content_depositor_service.rb +4 -1
  345. data/app/services/hyrax/collection_member_service.rb +5 -1
  346. data/app/services/hyrax/collection_types/permissions_service.rb +0 -2
  347. data/app/services/hyrax/collections/collection_member_service.rb +44 -64
  348. data/app/services/hyrax/collections/managed_collections_service.rb +15 -2
  349. data/app/services/hyrax/collections/migration_service.rb +9 -3
  350. data/app/services/hyrax/collections/nested_collection_persistence_service.rb +1 -1
  351. data/app/services/hyrax/collections/nested_collection_query_service.rb +39 -19
  352. data/app/services/hyrax/collections/permissions_service.rb +0 -1
  353. data/app/services/hyrax/collections_service.rb +12 -12
  354. data/app/services/hyrax/custom_queries/find_collections_by_type.rb +1 -1
  355. data/app/services/hyrax/custom_queries/navigators/child_collections_navigator.rb +14 -3
  356. data/app/services/hyrax/custom_queries/navigators/child_filesets_navigator.rb +14 -3
  357. data/app/services/hyrax/custom_queries/navigators/child_works_navigator.rb +10 -3
  358. data/app/services/hyrax/custom_queries/navigators/collection_members.rb +1 -0
  359. data/app/services/hyrax/custom_queries/navigators/find_files.rb +3 -0
  360. data/app/services/hyrax/database_migrator.rb +13 -10
  361. data/app/services/hyrax/default_middleware_stack.rb +0 -6
  362. data/app/services/hyrax/ensure_well_formed_admin_set_service.rb +27 -0
  363. data/app/services/hyrax/file_set_fixity_check_service.rb +16 -17
  364. data/app/services/hyrax/file_set_type_service.rb +55 -0
  365. data/app/services/hyrax/graph_exporter.rb +64 -8
  366. data/app/services/hyrax/list_source_exporter.rb +16 -34
  367. data/app/services/hyrax/listeners.rb +22 -0
  368. data/app/services/hyrax/listeners/proxy_deposit_listener.rb +20 -0
  369. data/app/services/hyrax/listeners/workflow_listener.rb +36 -0
  370. data/app/services/hyrax/multiple_membership_checker.rb +2 -1
  371. data/app/services/hyrax/quick_classification_query.rb +2 -3
  372. data/app/services/hyrax/resource_visibility_propagator.rb +1 -1
  373. data/app/services/hyrax/search_service.rb +108 -0
  374. data/app/services/hyrax/simple_schema_loader.rb +3 -1
  375. data/app/services/hyrax/statistics/depositors/summary.rb +0 -1
  376. data/app/services/hyrax/statistics/system_stats.rb +0 -1
  377. data/app/services/hyrax/thumbnail_path_service.rb +6 -1
  378. data/app/services/hyrax/time_service.rb +10 -0
  379. data/app/services/hyrax/versioning_service.rb +4 -28
  380. data/app/services/hyrax/work_uploads_handler.rb +166 -0
  381. data/app/services/hyrax/workflow/action_taken_service.rb +14 -1
  382. data/app/services/hyrax/workflow/grant_edit_to_depositor.rb +3 -1
  383. data/app/services/hyrax/workflow/permission_generator.rb +14 -9
  384. data/app/services/hyrax/workflow/workflow_action_service.rb +1 -1
  385. data/app/services/hyrax/workflow/workflow_factory.rb +12 -10
  386. data/app/services/hyrax/working_directory.rb +0 -1
  387. data/app/services/hyrax/works/managed_works_service.rb +14 -2
  388. data/app/views/_controls.html.erb +1 -1
  389. data/app/views/hyrax/admin/collection_types/index.html.erb +1 -1
  390. data/app/views/hyrax/base/_member.html.erb +1 -1
  391. data/app/views/hyrax/base/_representative_media.html.erb +1 -1
  392. data/app/views/hyrax/base/iiif_viewers/_universal_viewer.html.erb +1 -1
  393. data/app/views/hyrax/base/show.html.erb +2 -2
  394. data/app/views/hyrax/batch_select/_add_button.html.erb +1 -1
  395. data/app/views/hyrax/collections/_default_group.html.erb +2 -0
  396. data/app/views/hyrax/collections/show.html.erb +1 -1
  397. data/app/views/hyrax/dashboard/works/_default_group.html.erb +2 -0
  398. data/app/views/hyrax/embargoes/_list_expired_active_embargoes.html.erb +1 -1
  399. data/app/views/hyrax/leases/_list_expired_active_leases.html.erb +2 -1
  400. data/app/views/hyrax/my/works/_default_group.html.erb +2 -0
  401. data/app/views/layouts/hyrax.html.erb +0 -15
  402. data/bin/db-migrate-seed.sh +9 -0
  403. data/bin/db-wait.sh +14 -0
  404. data/bin/hyrax-entrypoint.sh +15 -0
  405. data/chart/fcrepo/.gitignore +2 -0
  406. data/chart/fcrepo/.helmignore +23 -0
  407. data/chart/fcrepo/Chart.yaml +11 -0
  408. data/chart/fcrepo/README.md +50 -0
  409. data/chart/fcrepo/templates/NOTES.txt +21 -0
  410. data/chart/fcrepo/templates/_helpers.tpl +68 -0
  411. data/chart/fcrepo/templates/configmap-env.yaml +19 -0
  412. data/chart/fcrepo/templates/deployment.yaml +109 -0
  413. data/chart/fcrepo/templates/ingress.yaml +41 -0
  414. data/chart/fcrepo/templates/pvc.yaml +20 -0
  415. data/chart/fcrepo/templates/secret.yaml +12 -0
  416. data/chart/fcrepo/templates/service.yaml +15 -0
  417. data/chart/fcrepo/templates/serviceaccount.yaml +12 -0
  418. data/chart/fcrepo/templates/tests/test-connection.yaml +15 -0
  419. data/chart/fcrepo/values.yaml +79 -0
  420. data/chart/hyrax/.gitignore +2 -0
  421. data/chart/hyrax/.helmignore +23 -0
  422. data/chart/hyrax/Chart.yaml +27 -0
  423. data/chart/hyrax/README.md +69 -0
  424. data/chart/hyrax/templates/NOTES.txt +21 -0
  425. data/chart/hyrax/templates/_helpers.tpl +92 -0
  426. data/chart/hyrax/templates/configmap-env.yaml +32 -0
  427. data/chart/hyrax/templates/deployment.yaml +79 -0
  428. data/chart/hyrax/templates/fcrepo-secret.yaml +13 -0
  429. data/chart/hyrax/templates/hpa.yaml +28 -0
  430. data/chart/hyrax/templates/ingress.yaml +41 -0
  431. data/chart/hyrax/templates/secrets.yaml +12 -0
  432. data/chart/hyrax/templates/service.yaml +15 -0
  433. data/chart/hyrax/templates/serviceaccount.yaml +12 -0
  434. data/chart/hyrax/templates/tests/test-connection.yaml +15 -0
  435. data/chart/hyrax/values.yaml +97 -0
  436. data/config/initializers/indexing_adapter_initializer.rb +7 -12
  437. data/config/initializers/listeners.rb +2 -0
  438. data/config/locales/hyrax.en.yml +1 -1
  439. data/config/metadata/basic_metadata.yaml +13 -0
  440. data/db/seeds.rb +20 -0
  441. data/docker-compose.yml +132 -0
  442. data/documentation/developing-your-hyrax-based-app.md +271 -0
  443. data/documentation/legacyREADME.md +336 -0
  444. data/documentation/note-about-versions.md +15 -0
  445. data/hyrax.gemspec +7 -8
  446. data/lib/generators/hyrax/templates/config/initializers/hyrax.rb +4 -6
  447. data/lib/generators/hyrax/templates/config/locales/hyrax.es.yml +1 -1
  448. data/lib/generators/hyrax/templates/db/seeds.rb +16 -14
  449. data/lib/generators/hyrax/templates/uv.html +1 -1
  450. data/lib/generators/hyrax/work_resource/templates/controller.rb.erb +0 -5
  451. data/lib/generators/hyrax/work_resource/templates/form.rb.erb +1 -1
  452. data/lib/generators/hyrax/work_resource/templates/work.html.erb_spec.rb.erb +3 -2
  453. data/lib/hyrax.rb +17 -0
  454. data/lib/hyrax/configuration.rb +340 -200
  455. data/lib/hyrax/event_store.rb +5 -0
  456. data/lib/hyrax/form_fields.rb +1 -1
  457. data/lib/hyrax/indexer.rb +19 -3
  458. data/lib/hyrax/publisher.rb +71 -2
  459. data/lib/hyrax/resource_sync/change_list_writer.rb +1 -1
  460. data/lib/hyrax/resource_sync/resource_list_writer.rb +1 -1
  461. data/lib/hyrax/schema.rb +2 -2
  462. data/lib/hyrax/specs/capybara.rb +98 -0
  463. data/lib/hyrax/specs/clamav.rb +15 -0
  464. data/lib/hyrax/specs/disable_animations_in_test_environment.rb +53 -0
  465. data/lib/hyrax/specs/engine_routes.rb +11 -0
  466. data/lib/hyrax/specs/shared_specs/change_set.rb +11 -0
  467. data/lib/hyrax/specs/shared_specs/factories/strategies/json_strategy.rb +13 -0
  468. data/lib/hyrax/specs/shared_specs/factories/strategies/valkyrie_resource.rb +0 -11
  469. data/lib/hyrax/specs/shared_specs/hydra_works.rb +6 -0
  470. data/lib/hyrax/specs/shared_specs/indexers.rb +22 -5
  471. data/lib/hyrax/specs/shared_specs/metadata.rb +64 -0
  472. data/lib/hyrax/specs/spy_listener.rb +52 -26
  473. data/lib/hyrax/transactions/container.rb +13 -1
  474. data/lib/hyrax/transactions/steps/add_file_sets.rb +35 -0
  475. data/lib/hyrax/transactions/steps/save.rb +10 -4
  476. data/lib/hyrax/transactions/steps/save_access_control.rb +29 -0
  477. data/lib/hyrax/transactions/steps/set_default_admin_set.rb +1 -1
  478. data/lib/hyrax/transactions/update_work.rb +3 -1
  479. data/lib/hyrax/transactions/work_create.rb +3 -1
  480. data/lib/hyrax/version.rb +1 -1
  481. data/lib/tasks/collection_type_global_id.rake +22 -0
  482. data/lib/tasks/default_admin_set.rake +5 -0
  483. data/lib/wings.rb +1 -1
  484. data/lib/wings/active_fedora_converter.rb +71 -123
  485. data/lib/wings/active_fedora_converter/default_work.rb +129 -0
  486. data/lib/wings/active_fedora_converter/nested_resource.rb +25 -0
  487. data/lib/wings/attribute_transformer.rb +28 -1
  488. data/lib/wings/converter_value_mapper.rb +70 -3
  489. data/lib/wings/model_registry.rb +4 -3
  490. data/lib/wings/model_transformer.rb +25 -7
  491. data/lib/wings/orm_converter.rb +19 -23
  492. data/lib/wings/services/custom_queries/find_collections_by_type.rb +1 -1
  493. data/lib/wings/services/custom_queries/find_file_metadata.rb +65 -38
  494. data/lib/wings/services/file_converter_service.rb +6 -55
  495. data/lib/wings/services/file_metadata_builder.rb +12 -8
  496. data/lib/wings/setup.rb +56 -9
  497. data/lib/wings/transformer_value_mapper.rb +1 -0
  498. data/lib/wings/valkyrie/metadata_adapter.rb +2 -2
  499. data/lib/wings/valkyrie/persister.rb +13 -14
  500. data/lib/wings/valkyrie/storage.rb +94 -0
  501. data/tasks/benchmark.rake +56 -0
  502. data/template.rb +1 -3
  503. metadata +346 -54
  504. data/lib/hyrax/callbacks.rb +0 -27
  505. data/lib/wings/hydra/pcdm/models/concerns/collection_valkyrie_behavior.rb +0 -28
  506. data/lib/wings/hydra/pcdm/models/concerns/object_valkyrie_behavior.rb +0 -28
  507. data/lib/wings/hydra/pcdm/models/concerns/pcdm_valkyrie_behavior.rb +0 -171
  508. data/lib/wings/hydra/works/models/concerns/collection_valkyrie_behavior.rb +0 -31
  509. data/lib/wings/hydra/works/models/concerns/file_set_valkyrie_behavior.rb +0 -31
  510. data/lib/wings/hydra/works/models/concerns/work_valkyrie_behavior.rb +0 -60
  511. data/lib/wings/models/concerns/collection_behavior.rb +0 -39
  512. data/lib/wings/models/multi_checksum.rb +0 -18
  513. data/lib/wings/services/id_converter_service.rb +0 -15
  514. data/lib/wings/valkyrie/storage/active_fedora.rb +0 -27
@@ -3,17 +3,8 @@
3
3
  module Hyrax
4
4
  ##
5
5
  # Indexes properties common to PCDM Collections
6
- class ValkyrieCollectionIndexer < Hyrax::ValkyrieIndexer
7
- include Hyrax::ResourceIndexer
8
- include Hyrax::PermissionIndexer
9
- include Hyrax::VisibilityIndexer
10
- include Hyrax::Indexer(:core_metadata)
11
-
12
- def to_solr
13
- super.tap do |index_document|
14
- index_document[:generic_type_sim] = ['Collection']
15
- index_document[:thumbnail_path_ss] = Hyrax::CollectionThumbnailPathService.call(resource)
16
- end
17
- end
6
+ #
7
+ # @deprecated use Hyrax::PcdmCollectionIndexer instead
8
+ class ValkyrieCollectionIndexer < Hyrax::PcdmCollectionIndexer
18
9
  end
19
10
  end
@@ -4,22 +4,22 @@ module Hyrax
4
4
  ##
5
5
  # @api public
6
6
  #
7
- # Transforms {Valkyrie::Resource} models to solr-ready key-value hashes. Use
8
- # `#to_solr` to retrieve the indexable hash.
7
+ # Transforms +Valkyrie::Resource+ models to solr-ready key-value hashes. Use
8
+ # {#to_solr} to retrieve the indexable hash.
9
9
  #
10
10
  # The default {Hyrax::ValkyrieIndexer} implementation provides minimal
11
- # indexing for the Valkyrie id and the reserved `#created_at` and
12
- # `#updated_at` attributes.
11
+ # indexing for the Valkyrie id and the reserved +#created_at+ and
12
+ # +#updated_at+ attributes.
13
13
  #
14
14
  # Custom indexers inheriting from others are responsible for providing a full
15
15
  # index hash. A common pattern for doing this is to employ method composition
16
16
  # to retrieve the parent's data, then modify it:
17
- # `def to_solr; super.tap { |index_document| transform(index_document) }; end`.
17
+ # +def to_solr; super.tap { |index_document| transform(index_document) }; end+.
18
18
  # This technique creates infinitely composible index building behavior, with
19
19
  # indexers that can always see the state of the resource and the full current
20
20
  # index document.
21
21
  #
22
- # It's recommended to *never* modify the state of `resource` in an indexer.
22
+ # It's recommended to *never* modify the state of +resource+ in an indexer.
23
23
  #
24
24
  # @example defining a custom indexer with composition
25
25
  # class MyIndexer < ValkyrieIndexer
@@ -55,17 +55,6 @@ module Hyrax
55
55
  # @return [Valkyrie::Resource]
56
56
  attr_reader :resource
57
57
 
58
- ##
59
- # @api public
60
- # @param [Valkyrie::Resource] resource
61
- #
62
- # @return [#to_solr]
63
- def self.for(resource:)
64
- indexer_class = "#{resource.class}Indexer".safe_constantize || ValkyrieIndexer
65
-
66
- indexer_class.new(resource: resource)
67
- end
68
-
69
58
  ##
70
59
  # @api private
71
60
  # @param [Valkyrie::Resource] resource
@@ -83,5 +72,44 @@ module Hyrax
83
72
  "updated_at_dtsi": resource.updated_at
84
73
  }
85
74
  end
75
+
76
+ ##
77
+ # @api private
78
+ # @note provided for ActiveFedora compatibility.
79
+ def generate_solr_document
80
+ to_solr.stringify_keys
81
+ end
82
+
83
+ class << self
84
+ ##
85
+ # @api public
86
+ # @param resource [Valkyrie::Resource] an instance of a +Valkyrie::Resource+
87
+ # or an inherited class
88
+ # @note This factory will attempt to return an indexer following a naming convention
89
+ # where the indexer for a resource class is expected to be the class name
90
+ # appended with 'Indexer'. It will return default {ValkyrieIndexer} if
91
+ # an indexer class following the naming convention is not found.
92
+ #
93
+ # @return [Valkyrie::Indexer] an instance of ValkyrieIndexer or an inherited class based on naming convention
94
+ #
95
+ # @example
96
+ # ValkyrieIndexer.for(resource: Book.new) # => #<BookIndexer ...>
97
+ def for(resource:)
98
+ indexer_class_for(resource).new(resource: resource)
99
+ end
100
+
101
+ private
102
+
103
+ ##
104
+ # @param [Object]
105
+ # @return [Class]
106
+ def indexer_class_for(resource)
107
+ indexer_class = "#{resource.class.name}Indexer".safe_constantize
108
+
109
+ return indexer_class if indexer_class.is_a?(Class) &&
110
+ indexer_class.instance_methods.include?(:to_solr)
111
+ ValkyrieIndexer
112
+ end
113
+ end
86
114
  end
87
115
  end
@@ -8,5 +8,21 @@ module Hyrax
8
8
  include Hyrax::PermissionIndexer
9
9
  include Hyrax::VisibilityIndexer
10
10
  include Hyrax::Indexer(:core_metadata)
11
+
12
+ def to_solr # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
13
+ super.tap do |solr_doc|
14
+ solr_doc['generic_type_sim'] = ['Work']
15
+ solr_doc['suppressed_bsi'] = suppressed?(resource)
16
+ solr_doc['admin_set_id_ssim'] = [resource.admin_set_id.to_s]
17
+ solr_doc['member_of_collection_ids_ssim'] = resource.member_of_collection_ids.map(&:to_s)
18
+ solr_doc['member_ids_ssim'] = resource.member_ids.map(&:to_s)
19
+ end
20
+ end
21
+
22
+ private
23
+
24
+ def suppressed?(resource)
25
+ Hyrax::ResourceStatus.new(resource: resource).inactive?
26
+ end
11
27
  end
12
28
  end
@@ -9,8 +9,9 @@ class AttachFilesToWorkJob < Hyrax::ApplicationJob
9
9
  case work
10
10
  when ActiveFedora::Base
11
11
  perform_af(work, uploaded_files, work_attributes)
12
- when Valkyrie::Resource
13
- perform_valkyrie(work, uploaded_files, work_attributes)
12
+ else
13
+ Hyrax::WorkUploadsHandler.new(work: work).add(files: uploaded_files).attach ||
14
+ raise("Could not complete AttachFilesToWorkJob. Some of these are probably in an undesirable state: #{uploaded_files}")
14
15
  end
15
16
  end
16
17
 
@@ -35,45 +36,6 @@ class AttachFilesToWorkJob < Hyrax::ApplicationJob
35
36
  end
36
37
  end
37
38
 
38
- def perform_valkyrie(work, uploaded_files, work_attributes)
39
- validate_files!(uploaded_files)
40
- depositor = proxy_or_depositor(work)
41
- user = User.find_by_user_key(depositor)
42
- work_permissions = permissions_map(work.permission_manager.acl.permissions)
43
- uploaded_files.each do |uploaded_file|
44
- next if uploaded_file.file_set_uri.present?
45
- attach_uploaded_file!(uploaded_file, user, work, work_permissions, work_attributes)
46
- end
47
- end
48
-
49
- def attach_uploaded_file!(uploaded_file, user, work, work_permissions, work_attributes)
50
- file_set = Hyrax.persister.save(resource: Hyrax::FileSet.new(user: user))
51
- actor = Hyrax::Actors::FileSetActor.new(file_set, user)
52
- uploaded_file.add_file_set!(actor.file_set)
53
- file_acl = Hyrax::AccessControlList.new(resource: actor.file_set)
54
- work_permissions.each { |perm| file_acl.grant(perm[:mode]).to(perm[:agent]).save }
55
- file_acl.save
56
- metadata = visibility_attributes(work_attributes)
57
- actor.create_metadata(metadata)
58
- actor.create_content(uploaded_file)
59
- actor.attach_to_work(work)
60
- end
61
-
62
- # Return array of hashes representing permissions without their :access_to objects
63
- # @param permissions [Permission]
64
- # @return [Array<Hash>]
65
- def permissions_map(permissions)
66
- permissions.collect { |p| { agent: agent_object(p.agent), mode: p.mode } }
67
- end
68
-
69
- # Converts string representation of Permission.agent to either User or Hyrax::Group
70
- # @param agent [String]
71
- # @return [User] or [Hyrax::Group]
72
- def agent_object(agent)
73
- return Hyrax::Group.new(agent.sub(Hyrax::Group.name_prefix, '')) if agent.starts_with?(Hyrax::Group.name_prefix)
74
- User.find_by_user_key(agent)
75
- end
76
-
77
39
  def create_permissions(work, depositor)
78
40
  work.edit_users += [depositor]
79
41
  work.edit_users = work.edit_users.dup
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+ class EmbargoExpiryJob < Hyrax::ApplicationJob
3
+ def perform
4
+ records_with_expired_embargos.each do |id|
5
+ work = ActiveFedora::Base.find(id)
6
+ Hyrax::Actors::EmbargoActor.new(work).destroy
7
+ end
8
+ end
9
+
10
+ ##
11
+ # @return [Enumerator<String>] ids for all the objects that have expired active embargoes
12
+ def records_with_expired_embargos
13
+ Hyrax::EmbargoService.assets_with_expired_embargoes.map(&:id)
14
+ end
15
+ end
@@ -1,17 +1,18 @@
1
1
  # frozen_string_literal: true
2
- # A generic job for sending events to a user.
3
- #
2
+
3
+ ##
4
4
  # @abstract
5
+ #
6
+ # A generic job for sending events to a user.
5
7
  class EventJob < Hyrax::ApplicationJob
6
8
  include Rails.application.routes.url_helpers
7
- # For link_to
8
- include ActionView::Helpers
9
- # For link_to_profile
10
- include HyraxHelper
9
+ include ActionView::Helpers # For link_to
10
+ include HyraxHelper # For link_to_profile
11
11
 
12
12
  queue_as Hyrax.config.ingest_queue_name
13
13
  attr_reader :depositor
14
14
 
15
+ ##
15
16
  # @param [User] depositor the user to create the event for
16
17
  def perform(depositor)
17
18
  @depositor = depositor
@@ -19,8 +20,10 @@ class EventJob < Hyrax::ApplicationJob
19
20
  log_user_event(depositor)
20
21
  end
21
22
 
22
- # override to provide your specific action for the event you are logging
23
+ ##
23
24
  # @abstract
25
+ #
26
+ # override to provide your specific action for the event you are logging
24
27
  def action
25
28
  raise(NotImplementedError, "#action should be implemented by an child class of EventJob")
26
29
  end
@@ -31,7 +34,11 @@ class EventJob < Hyrax::ApplicationJob
31
34
  @event ||= Hyrax::Event.create_now(action)
32
35
  end
33
36
 
37
+ ##
34
38
  # log the event to the users event stream
39
+ #
40
+ # @param [User] depositor the user to create the event for
41
+ # @return [void]
35
42
  def log_user_event(depositor)
36
43
  depositor.log_event(event)
37
44
  end
@@ -6,7 +6,12 @@ module Hyrax
6
6
  class ApplicationJob < ::ApplicationJob
7
7
  before_enqueue do |job|
8
8
  job.arguments.map! do |arg|
9
- arg.is_a?(Valkyrie::Resource) ? Hyrax::ActiveJobProxy.new(resource: arg) : arg
9
+ case arg
10
+ when Valkyrie::Resource
11
+ Hyrax::ValkyrieGlobalIdProxy.new(resource: arg)
12
+ else
13
+ arg
14
+ end
10
15
  end
11
16
  end
12
17
  end
@@ -3,10 +3,14 @@ require 'uri'
3
3
  require 'tmpdir'
4
4
  require 'browse_everything/retriever'
5
5
 
6
- # Given a FileSet that has an import_url property,
7
- # download that file and put it into Fedora
8
- # Called by AttachFilesToWorkJob (when files are uploaded to s3)
9
- # and CreateWithRemoteFilesActor when files are located in some other service.
6
+ ##
7
+ # Given a {FileSet} that has an +#import_url+ property, download that file and
8
+ # deposit into Fedora.
9
+ #
10
+ # @note this is commonly called during deposit by {AttachFilesToWorkJob} (when
11
+ # files are uploaded directly as {Hyrax::UploadedFile}) and
12
+ # {Hyrax::Actors::CreateWithRemoteFilesActor} when files are located in
13
+ # some other service.
10
14
  class ImportUrlJob < Hyrax::ApplicationJob
11
15
  queue_as Hyrax.config.ingest_queue_name
12
16
  attr_reader :file_set, :operation, :headers, :user, :uri
@@ -16,6 +20,7 @@ class ImportUrlJob < Hyrax::ApplicationJob
16
20
  operation.pending_job(job)
17
21
  end
18
22
 
23
+ ##
19
24
  # @param [FileSet] file_set
20
25
  # @param [Hyrax::BatchCreateOperation] operation
21
26
  # @param [Hash] headers - header data to use in interaction with remote url
@@ -85,8 +90,9 @@ class ImportUrlJob < Hyrax::ApplicationJob
85
90
  Rails.logger.debug("ImportUrlJob: Closing #{File.join(dir, filename)}")
86
91
  end
87
92
 
93
+ ##
88
94
  # Send message to user on download failure
89
- # @param filename [String] the filename of the file to download
95
+ #
90
96
  # @param error_message [String] the download error message
91
97
  def send_error(error_message)
92
98
  file_set.errors.add('Error:', error_message)
@@ -16,26 +16,11 @@ class InheritPermissionsJob < Hyrax::ApplicationJob
16
16
 
17
17
  private
18
18
 
19
- # Return array of hashes representing permissions without their :access_to objects
20
- # @param permissions [Permission]
21
- # @return [Array<Hash>]
22
- def permissions_map(permissions)
23
- permissions.collect { |p| { agent: agent_object(p.agent), mode: p.mode } }
24
- end
25
-
26
19
  # Returns a list of member file_sets for a work
27
20
  # @param work [Resource]
28
21
  # @return [Array<Hyrax::File_Set>]
29
22
  def file_sets_for(work)
30
- Hyrax.query_service.custom_queries.find_child_filesets(resource: work)
31
- end
32
-
33
- # Converts string representation of Permission.agent to either User or Hyrax::Group
34
- # @param agent [String]
35
- # @return [User] or [Hyrax::Group]
36
- def agent_object(agent)
37
- return Hyrax::Group.new(agent.sub(Hyrax::Group.name_prefix, '')) if agent.starts_with?(Hyrax::Group.name_prefix)
38
- User.find_by_user_key(agent)
23
+ Hyrax.custom_queries.find_child_filesets(resource: work)
39
24
  end
40
25
 
41
26
  # Perform the copy from the work to the contained filesets
@@ -61,15 +46,11 @@ class InheritPermissionsJob < Hyrax::ApplicationJob
61
46
  #
62
47
  # @param work containing access level and filesets
63
48
  def valkyrie_perform(work)
64
- work_permissions = permissions_map(work.permission_manager.acl.permissions)
65
- file_sets_for(work).each do |file|
66
- file_acl = Hyrax::AccessControlList.new(resource: file)
67
- file_permissions = permissions_map(file_acl.permissions)
68
- # grant new work permissions to member file_sets
69
- (work_permissions - file_permissions).each { |perm| file_acl.grant(perm[:mode]).to(perm[:agent]).save }
70
- # remove permissions that are not on work from member file_sets
71
- (file_permissions - work_permissions).each { |perm| file_acl.revoke(perm[:mode]).from(perm[:agent]).save }
72
- file_acl.save
49
+ work_acl = Hyrax::AccessControlList.new(resource: work)
50
+
51
+ file_sets_for(work).each do |file_set|
52
+ Hyrax::AccessControlList
53
+ .copy_permissions(source: work_acl, target: file_set)
73
54
  end
74
55
  end
75
56
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+ class LeaseExpiryJob < Hyrax::ApplicationJob
3
+ def perform
4
+ records_with_expired_leases.each do |id|
5
+ work = ActiveFedora::Base.find(id)
6
+ Hyrax::Actors::LeaseActor.new(work).destroy
7
+ end
8
+ end
9
+
10
+ ##
11
+ # @return [Enumerator<String>] ids for all the objects that have expired active leases
12
+ def records_with_expired_leases
13
+ Hyrax::LeaseService.assets_with_expired_leases.map(&:id)
14
+ end
15
+ end
@@ -17,7 +17,7 @@
17
17
  # @see Hyrax::DefaultAdminSetActor
18
18
  # @see Hyrax::ApplyPermissionTemplateActor
19
19
  class AdminSet < ActiveFedora::Base
20
- include Hydra::AccessControls::WithAccessRight
20
+ include Hydra::AccessControls::Permissions
21
21
  include Hyrax::Noid
22
22
  include Hyrax::HumanReadableType
23
23
  include Hyrax::HasRepresentative
@@ -1,5 +1,27 @@
1
1
  # frozen_string_literal: true
2
2
  module Hyrax
3
+ ##
4
+ # Provides Hyrax's engine level user/group permissions.
5
+ #
6
+ # @note This is intended as a mixin layered over
7
+ # +Blacklight::AccessControls::Ability+ and +Hydra::AccessControls+. Its
8
+ # implementation may depend in part on behavioral details of either of those
9
+ # two mixins. As of Hyrax 3.0.0 there's an ongoing effort to clarify and
10
+ # document the specific dependencies.
11
+ #
12
+ # @todo catalog and document the actions we authorize here. everything we
13
+ # allow or disable from this module should be clear to application side
14
+ # adopters.
15
+ #
16
+ # @example creating an application Ability
17
+ # # app/models/ability.rb
18
+ # class Ability
19
+ # include Hydra::Ability
20
+ # include Hyrax::Ability
21
+ # end
22
+ #
23
+ # @see https://www.rubydoc.info/github/CanCanCommunity/cancancan
24
+ # @see https://www.rubydoc.info/gems/blacklight-access_controls/
3
25
  module Ability
4
26
  extend ActiveSupport::Concern
5
27
 
@@ -11,9 +33,9 @@ module Hyrax
11
33
  include Hyrax::Ability::SolrDocumentAbility
12
34
 
13
35
  class_attribute :admin_group_name, :registered_group_name, :public_group_name
14
- self.admin_group_name = 'admin'
15
- self.registered_group_name = 'registered'
16
- self.public_group_name = 'public' # TODO: find hard coded values and replace with this
36
+ self.admin_group_name = Hyrax.config.admin_user_group_name
37
+ self.registered_group_name = Hyrax.config.registered_user_group_name
38
+ self.public_group_name = Hyrax.config.public_user_group_name
17
39
  self.ability_logic += [:admin_permissions,
18
40
  :curation_concerns_permissions,
19
41
  :operation_abilities,
@@ -69,19 +91,12 @@ module Hyrax
69
91
 
70
92
  private
71
93
 
72
- # @return [Boolean] true if the user has at least one admin set they can deposit into.
73
- def admin_set_with_deposit?
74
- ids = PermissionTemplateAccess.for_user(ability: self,
75
- access: ['deposit', 'manage'])
76
- .joins(:permission_template)
77
- .select(:source_id)
78
- .distinct
79
- .pluck(:source_id)
80
- query = "_query_:\"{!raw f=has_model_ssim}AdminSet\" AND {!terms f=id}#{ids.join(',')}"
81
- Hyrax::SolrService.count(query).positive?
82
- end
94
+ # @!group Ability Logic Library
83
95
 
84
- # This overrides hydra-head, (and restores the method from blacklight-access-controls)
96
+ ##
97
+ # @api public
98
+ #
99
+ # Overrides hydra-head, (and restores the method from blacklight-access-controls)
85
100
  def download_permissions
86
101
  can :download, String do |id|
87
102
  test_download(id)
@@ -93,13 +108,31 @@ module Hyrax
93
108
  end
94
109
  end
95
110
 
96
- # Add this to your ability_logic if you want all logged in users to be able
97
- # to submit content
111
+ ##
112
+ # @api public
113
+ #
114
+ # Add this to your {.ability_logic} if you want all logged in users to be able
115
+ # to submit content.
116
+ #
117
+ # @note this is normally injected into an application +::Ability+ by the
118
+ # hyrax install generator.
119
+ #
120
+ # @example
121
+ # self.ability_logic += [:everyone_can_create_curation_concerns]
98
122
  def everyone_can_create_curation_concerns
99
123
  return unless registered_user?
100
124
  can :create, curation_concerns_models
101
125
  end
102
126
 
127
+ ##
128
+ # @api public
129
+ #
130
+ # Allow registered users to create {UploadedFile} and {BatchUploadItem}
131
+ #
132
+ # @note included in {.ability_logic} by default.
133
+ #
134
+ # @example
135
+ # self.ability_logic += [:uploaded_file_abilities]
103
136
  def uploaded_file_abilities
104
137
  return unless registered_user?
105
138
  can :create, [UploadedFile, BatchUploadItem]
@@ -109,6 +142,15 @@ module Hyrax
109
142
  # Note: cannot call `authorized_models` without going recursive.
110
143
  end
111
144
 
145
+ ##
146
+ # @api public
147
+ #
148
+ # Permissions for work transfers and proxy deposit models.
149
+ #
150
+ # @note included in {.ability_logic} by default.
151
+ #
152
+ # @example
153
+ # self.ability_logic += [:proxy_deposit_abilities]
112
154
  def proxy_deposit_abilities
113
155
  if Flipflop.transfer_works?
114
156
  can :transfer, String do |id|
@@ -124,15 +166,48 @@ module Hyrax
124
166
  can :destroy, ProxyDepositRequest, sending_user_id: current_user.id, status: 'pending'
125
167
  end
126
168
 
169
+ ##
170
+ # @api public
171
+ #
172
+ # Permissions for users to edit themselves and view other users
173
+ #
174
+ # @note included in {.ability_logic} by default.
175
+ #
176
+ # @example
177
+ # self.ability_logic += [:user_abilities]
127
178
  def user_abilities
128
179
  can [:edit, :update, :toggle_trophy], ::User, id: current_user.id
129
180
  can :show, ::User
130
181
  end
131
182
 
183
+ ##
184
+ # @api public
185
+ #
186
+ # Allow admins to manage {FeaturedWork} data.
187
+ #
188
+ # @note included in {.ability_logic} by default.
189
+ #
190
+ # @example
191
+ # self.ability_logic += [:featured_work_abilities]
132
192
  def featured_work_abilities
133
193
  can [:create, :destroy, :update], FeaturedWork if admin?
134
194
  end
135
195
 
196
+ ##
197
+ # @api public
198
+ #
199
+ # Allow everyone to read {ContentBlock} data.
200
+ #
201
+ # Allow admins to read the admin dashboard, update {ContentBlock}, and edit
202
+ # {SolrDocument}(!?)
203
+ #
204
+ # @todo why does this allow so many different things? what is going on with
205
+ # `can :edit, ::SolrDocument`.
206
+ #
207
+ # @note included in {.ability_logic} by default.
208
+ #
209
+ # @example
210
+ # self.ability_logic += [:editor_abilities]
136
211
  def editor_abilities
137
212
  can :read, ContentBlock
138
213
  return unless admin?
@@ -142,26 +217,76 @@ module Hyrax
142
217
  can :edit, ::SolrDocument
143
218
  end
144
219
 
220
+ ##
221
+ # @api public
222
+ #
223
+ # Allow admins to read {Hyrax::Statistics}; allow read users to do the
224
+ # +:stats+ action.
225
+ #
226
+ # @note included in {.ability_logic} by default.
227
+ #
228
+ # @example
229
+ # self.ability_logic += [:stats_abilities]
145
230
  def stats_abilities
146
231
  can :read, Hyrax::Statistics if admin?
147
232
  alias_action :stats, to: :read
148
233
  end
149
234
 
235
+ ##
236
+ # @api public
237
+ #
238
+ # Allow read users to do the +:citation+ action
239
+ #
240
+ # @note included in {.ability_logic} by default.
241
+ #
242
+ # @example
243
+ # self.ability_logic += [:citation_abilities]
150
244
  def citation_abilities
151
245
  alias_action :citation, to: :read
152
246
  end
153
247
 
248
+ ##
249
+ # @api public
250
+ #
251
+ # Allow admin users to manage {Hyrax::Feature} data.
252
+ #
253
+ # @note included in {.ability_logic} by default.
254
+ #
255
+ # @example
256
+ # self.ability_logic += [:feature_abilities]
154
257
  def feature_abilities
155
258
  can :manage, Hyrax::Feature if admin?
156
259
  end
157
260
 
261
+ ##
262
+ # @api public
263
+ #
264
+ # Allow users to read their own {Hyrax::Operation} data.
265
+ #
266
+ # @note included in {.ability_logic} by default.
267
+ #
268
+ # @example
269
+ # self.ability_logic += [:operation_abilities]
158
270
  def operation_abilities
159
271
  can :read, Hyrax::Operation, user_id: current_user.id
160
272
  end
161
273
 
162
- # We check based on the depositor, because the depositor may not have edit
163
- # access to the work if it went through a mediated deposit workflow that
164
- # removes edit access for the depositor.
274
+ ##
275
+ # @api public
276
+ #
277
+ # Allow depositors to create and destroy {Trophy} data.
278
+ #
279
+ # @note We check based on the depositor, because the depositor may not have
280
+ # edit access to the work if it went through a mediated deposit workflow
281
+ # that removes edit access for the depositor.
282
+ #
283
+ # @note included in {.ability_logic} by default.
284
+ #
285
+ # @todo the note isn't very convincing. why do depositors without edit
286
+ # access need trophy management abilities?
287
+ #
288
+ # @example
289
+ # self.ability_logic += [:trophy_abilities]
165
290
  def trophy_abilities
166
291
  can [:create, :destroy], Trophy do |t|
167
292
  doc = Hyrax::SolrService.search_by_id(t.work_id, fl: 'depositor_ssim')
@@ -169,6 +294,17 @@ module Hyrax
169
294
  end
170
295
  end
171
296
 
297
+ ##
298
+ # @api public
299
+ #
300
+ # Allow editor to view versions and the file manager; block non-admins from
301
+ # indexing embargo and lease.
302
+ #
303
+ # @note included in {.ability_logic} by default.
304
+ # @todo make this do one thing. extract embargo/lease rules elsewhere.
305
+ #
306
+ # @example
307
+ # self.ability_logic += [:curation_concerns_permissions]
172
308
  def curation_concerns_permissions
173
309
  # user can version if they can edit
174
310
  alias_action :versions, to: :update
@@ -179,6 +315,15 @@ module Hyrax
179
315
  cannot :index, Hydra::AccessControls::Lease
180
316
  end
181
317
 
318
+ ##
319
+ # @api public
320
+ #
321
+ # Give admins sweeping permissions.
322
+ #
323
+ # @note included in {.ability_logic} by default.
324
+ #
325
+ # @example
326
+ # self.ability_logic += [:admin_permissions]
182
327
  def admin_permissions
183
328
  return unless admin?
184
329
  # TODO: deprecate this. We no longer have a dashboard just for admins
@@ -193,13 +338,39 @@ module Hyrax
193
338
  can :manage, :collection_types
194
339
  end
195
340
 
196
- # TODO: elr - How is this used? How does it fit with collection participants?
341
+ ##
342
+ # @api public
343
+ #
344
+ # Allow registered users to +:collect+ everything, and to +:files+ thing
345
+ # they can read.
346
+ #
347
+ # @note included in {.ability_logic} by default.
348
+ #
349
+ # @todo what in the world does it mean to +:files+? what does "members will
350
+ # be filtered separately" mean?
351
+ #
352
+ # @example
353
+ # self.ability_logic += [:add_to_collection]
197
354
  def add_to_collection
198
355
  return unless registered_user?
199
356
  alias_action :files, to: :read # members will be filtered separately
200
357
  can :collect, :all
201
358
  end
202
359
 
360
+ # @!endgroup
361
+
362
+ # @return [Boolean] true if the user has at least one admin set they can deposit into.
363
+ def admin_set_with_deposit?
364
+ ids = PermissionTemplateAccess.for_user(ability: self,
365
+ access: ['deposit', 'manage'])
366
+ .joins(:permission_template)
367
+ .select(:source_id)
368
+ .distinct
369
+ .pluck(:source_id)
370
+ query = "_query_:\"{!raw f=has_model_ssim}AdminSet\" AND {!terms f=id}#{ids.join(',')}"
371
+ Hyrax::SolrService.count(query).positive?
372
+ end
373
+
203
374
  def registered_user?
204
375
  return false if current_user.guest?
205
376
  user_groups.include? registered_group_name