hyrax 3.0.0 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (287) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +46 -13
  3. data/.dassie/Gemfile +11 -6
  4. data/.dassie/app/controllers/catalog_controller.rb +6 -0
  5. data/.dassie/config/initializers/hyrax.rb +5 -0
  6. data/.dassie/config/initializers/riiif.rb +22 -20
  7. data/.dassie/config/role_map.yml +2 -0
  8. data/.dassie/db/seeds.rb +1 -1
  9. data/.dassie/package.json +3 -5
  10. data/.dockerignore +3 -0
  11. data/.env +1 -2
  12. data/.rubocop.yml +4 -0
  13. data/CONTAINERS.md +21 -1
  14. data/Dockerfile +42 -17
  15. data/Gemfile +21 -27
  16. data/app/actors/hyrax/actors/base_actor.rb +2 -2
  17. data/app/actors/hyrax/actors/collections_membership_actor.rb +3 -3
  18. data/app/actors/hyrax/actors/create_with_remote_files_actor.rb +85 -63
  19. data/app/actors/hyrax/actors/create_with_remote_files_ordered_members_actor.rb +7 -42
  20. data/app/actors/hyrax/actors/file_set_actor.rb +12 -5
  21. data/app/assets/stylesheets/hyrax/_styles.scss +5 -0
  22. data/app/controllers/concerns/hyrax/collections_controller_behavior.rb +30 -10
  23. data/app/controllers/concerns/hyrax/controller.rb +13 -2
  24. data/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb +21 -9
  25. data/app/controllers/concerns/hyrax/leases_controller_behavior.rb +14 -5
  26. data/app/controllers/concerns/hyrax/works_controller_behavior.rb +22 -3
  27. data/app/controllers/hyrax/admin/admin_sets_controller.rb +2 -19
  28. data/app/controllers/hyrax/admin/permission_template_accesses_controller.rb +5 -6
  29. data/app/controllers/hyrax/admin/workflows_controller.rb +8 -2
  30. data/app/controllers/hyrax/collections_controller.rb +3 -1
  31. data/app/controllers/hyrax/dashboard/collection_members_controller.rb +24 -17
  32. data/app/controllers/hyrax/dashboard/collections_controller.rb +99 -35
  33. data/app/controllers/hyrax/dashboard/nest_collections_controller.rb +75 -39
  34. data/app/controllers/hyrax/file_sets_controller.rb +49 -13
  35. data/app/controllers/hyrax/my_controller.rb +4 -4
  36. data/app/controllers/hyrax/permissions_controller.rb +3 -4
  37. data/app/controllers/hyrax/workflow_actions_controller.rb +11 -6
  38. data/app/forms/hyrax/forms/administrative_set_form.rb +62 -0
  39. data/app/forms/hyrax/forms/collection_form.rb +14 -8
  40. data/app/forms/hyrax/forms/dashboard/nest_collection_form.rb +38 -6
  41. data/app/forms/hyrax/forms/file_set_form.rb +46 -0
  42. data/app/forms/hyrax/forms/pcdm_collection_form.rb +64 -0
  43. data/app/forms/hyrax/forms/permission.rb +23 -0
  44. data/app/forms/hyrax/forms/permission_template_form.rb +8 -2
  45. data/app/forms/hyrax/forms/resource_form.rb +34 -26
  46. data/app/forms/hyrax/forms/work_form.rb +5 -2
  47. data/app/forms/hyrax/forms/workflow_action_form.rb +4 -0
  48. data/app/helpers/hyrax/batch_edits_helper.rb +3 -1
  49. data/app/helpers/hyrax/collections_helper.rb +88 -2
  50. data/app/helpers/hyrax/dashboard_helper_behavior.rb +16 -5
  51. data/app/helpers/hyrax/embargo_helper.rb +4 -0
  52. data/app/helpers/hyrax/file_set_helper.rb +25 -6
  53. data/app/helpers/hyrax/hyrax_helper_behavior.rb +9 -0
  54. data/app/helpers/hyrax/lease_helper.rb +4 -0
  55. data/app/helpers/hyrax/url_helper.rb +4 -1
  56. data/app/helpers/hyrax/work_form_helper.rb +53 -0
  57. data/app/indexers/hyrax/administrative_set_indexer.rb +18 -0
  58. data/app/indexers/hyrax/pcdm_collection_indexer.rb +2 -0
  59. data/app/indexers/hyrax/valkyrie_file_set_indexer.rb +2 -0
  60. data/app/indexers/hyrax/valkyrie_indexer.rb +4 -3
  61. data/app/indexers/hyrax/valkyrie_work_indexer.rb +1 -1
  62. data/app/inputs/controlled_vocabulary_input.rb +2 -5
  63. data/app/jobs/attach_files_to_work_job.rb +19 -10
  64. data/app/jobs/attach_files_to_work_with_ordered_members_job.rb +6 -5
  65. data/app/jobs/ingest_local_file_job.rb +18 -2
  66. data/app/jobs/inherit_permissions_job.rb +9 -5
  67. data/app/models/admin_set.rb +22 -30
  68. data/app/models/collection_branding_info.rb +25 -9
  69. data/app/models/concerns/hyrax/ability/admin_set_ability.rb +31 -7
  70. data/app/models/concerns/hyrax/ability/collection_ability.rb +35 -20
  71. data/app/models/concerns/hyrax/ability/collection_type_ability.rb +1 -1
  72. data/app/models/concerns/hyrax/ability.rb +5 -3
  73. data/app/models/concerns/hyrax/collection_behavior.rb +17 -44
  74. data/app/models/concerns/hyrax/embargoable.rb +24 -0
  75. data/app/models/concerns/hyrax/file_set/characterization.rb +18 -12
  76. data/app/models/concerns/hyrax/solr_document_behavior.rb +11 -54
  77. data/app/models/concerns/hyrax/suppressible.rb +5 -0
  78. data/app/models/concerns/hyrax/user.rb +9 -3
  79. data/app/models/concerns/hyrax/work_behavior.rb +1 -1
  80. data/app/models/hyrax/administrative_set.rb +7 -1
  81. data/app/models/hyrax/file_set.rb +6 -0
  82. data/app/models/hyrax/pcdm_collection.rb +1 -0
  83. data/app/models/hyrax/permission.rb +1 -1
  84. data/app/models/hyrax/permission_template.rb +112 -12
  85. data/app/models/hyrax/virus_scanner.rb +27 -18
  86. data/app/models/hyrax/work.rb +1 -0
  87. data/app/models/hyrax/workflow_action_info.rb +16 -0
  88. data/app/models/sipity/agent.rb +1 -0
  89. data/app/models/sipity/comment.rb +17 -0
  90. data/app/models/sipity/entity.rb +30 -8
  91. data/app/models/sipity/workflow.rb +1 -0
  92. data/app/models/sipity.rb +53 -2
  93. data/app/presenters/hyrax/admin_set_options_presenter.rb +12 -8
  94. data/app/presenters/hyrax/admin_set_presenter.rb +13 -4
  95. data/app/presenters/hyrax/admin_set_selection_presenter.rb +116 -0
  96. data/app/presenters/hyrax/collection_presenter.rb +44 -23
  97. data/app/presenters/hyrax/file_set_presenter.rb +6 -1
  98. data/app/presenters/hyrax/file_usage.rb +3 -2
  99. data/app/presenters/hyrax/pcdm_member_presenter_factory.rb +119 -0
  100. data/app/presenters/hyrax/stats_usage_presenter.rb +2 -1
  101. data/app/presenters/hyrax/trophy_presenter.rb +33 -4
  102. data/app/presenters/hyrax/user_profile_presenter.rb +11 -1
  103. data/app/presenters/hyrax/version_list_presenter.rb +19 -0
  104. data/app/presenters/hyrax/version_presenter.rb +3 -2
  105. data/app/presenters/hyrax/work_show_presenter.rb +32 -6
  106. data/app/presenters/hyrax/work_usage.rb +5 -3
  107. data/app/renderers/hyrax/renderers/attribute_renderer.rb +10 -2
  108. data/app/search_builders/hyrax/abstract_type_relation.rb +4 -2
  109. data/app/search_builders/hyrax/admin_set_search_builder.rb +1 -1
  110. data/app/search_builders/hyrax/collection_member_search_builder.rb +6 -1
  111. data/app/search_builders/hyrax/dashboard/collections_search_builder.rb +1 -1
  112. data/app/search_builders/hyrax/exposed_models_relation.rb +1 -1
  113. data/app/search_builders/hyrax/filter_by_type.rb +1 -2
  114. data/app/search_builders/hyrax/my/collections_search_builder.rb +2 -2
  115. data/app/search_builders/hyrax/nested_collections_parent_search_builder.rb +1 -1
  116. data/app/search_builders/hyrax/single_collection_search_builder.rb +1 -1
  117. data/app/services/hyrax/admin_set_create_service.rb +136 -52
  118. data/app/services/hyrax/collection_types/permissions_service.rb +1 -1
  119. data/app/services/hyrax/collections/collection_member_search_service.rb +72 -0
  120. data/app/services/hyrax/collections/collection_member_service.rb +122 -27
  121. data/app/services/hyrax/collections/migration_service.rb +4 -2
  122. data/app/services/hyrax/collections/nested_collection_persistence_service.rb +12 -13
  123. data/app/services/hyrax/collections/nested_collection_query_service.rb +2 -0
  124. data/app/services/hyrax/collections/permissions_create_service.rb +82 -78
  125. data/app/services/hyrax/collections/permissions_service.rb +1 -1
  126. data/app/services/hyrax/contextual_path.rb +24 -1
  127. data/app/services/hyrax/curation_concern.rb +24 -2
  128. data/app/services/hyrax/custom_queries/find_file_metadata.rb +7 -5
  129. data/app/services/hyrax/custom_queries/navigators/parent_collections_navigator.rb +46 -0
  130. data/app/services/hyrax/default_middleware_stack.rb +11 -0
  131. data/app/services/hyrax/edit_permissions_service.rb +74 -41
  132. data/app/services/hyrax/ensure_well_formed_admin_set_service.rb +3 -3
  133. data/app/services/hyrax/find_objects_via_solr_service.rb +31 -0
  134. data/app/services/hyrax/listeners/active_fedora_acl_index_listener.rb +1 -0
  135. data/app/services/hyrax/listeners/member_cleanup_listener.rb +26 -0
  136. data/app/services/hyrax/listeners/metadata_index_listener.rb +25 -9
  137. data/app/services/hyrax/listeners/object_lifecycle_listener.rb +1 -1
  138. data/app/services/hyrax/listeners/trophy_cleanup_listener.rb +17 -0
  139. data/app/services/hyrax/listeners.rb +2 -0
  140. data/app/services/hyrax/multiple_membership_checker.rb +53 -29
  141. data/app/services/hyrax/permission_manager.rb +4 -4
  142. data/app/services/hyrax/persist_derivatives.rb +3 -1
  143. data/app/services/hyrax/resource_status.rb +7 -0
  144. data/app/services/hyrax/search_service.rb +4 -2
  145. data/app/services/hyrax/solr_query_builder_service.rb +45 -8
  146. data/app/services/hyrax/solr_query_service.rb +224 -0
  147. data/app/services/hyrax/solr_service.rb +9 -2
  148. data/app/services/hyrax/statistics/collections/over_time.rb +2 -1
  149. data/app/services/hyrax/statistics/depositors/summary.rb +2 -1
  150. data/app/services/hyrax/thumbnail_path_service.rb +1 -1
  151. data/app/services/hyrax/visibility_intention.rb +20 -2
  152. data/app/services/hyrax/visibility_propagator.rb +30 -1
  153. data/app/services/hyrax/work_uploads_handler.rb +17 -2
  154. data/app/services/hyrax/workflow/abstract_notification.rb +2 -2
  155. data/app/services/hyrax/workflow/action_taken_service.rb +16 -4
  156. data/app/services/hyrax/workflow/actionable_objects.rb +70 -0
  157. data/app/services/hyrax/workflow/activate_object.rb +5 -4
  158. data/app/services/hyrax/workflow/changes_required_notification.rb +5 -4
  159. data/app/services/hyrax/workflow/deactivate_object.rb +7 -5
  160. data/app/services/hyrax/workflow/deposited_notification.rb +8 -4
  161. data/app/services/hyrax/workflow/grant_edit_to_depositor.rb +7 -3
  162. data/app/services/hyrax/workflow/grant_read_to_depositor.rb +10 -3
  163. data/app/services/hyrax/workflow/object_in_workflow_decorator.rb +31 -0
  164. data/app/services/hyrax/workflow/revoke_edit_from_depositor.rb +8 -2
  165. data/app/services/hyrax/workflow/status_list_service.rb +43 -13
  166. data/app/services/hyrax/workflow/workflow_action_service.rb +4 -1
  167. data/app/views/hyrax/admin/admin_sets/_form.html.erb +1 -1
  168. data/app/views/hyrax/base/_form_child_work_relationships.html.erb +1 -1
  169. data/app/views/hyrax/base/_form_relationships.html.erb +1 -2
  170. data/app/views/hyrax/base/_form_rendering.html.erb +1 -1
  171. data/app/views/hyrax/base/_form_representative.html.erb +1 -1
  172. data/app/views/hyrax/base/_form_thumbnail.html.erb +1 -1
  173. data/app/views/hyrax/base/_form_visibility_error.html.erb +2 -0
  174. data/app/views/hyrax/base/_guts4form.html.erb +3 -3
  175. data/app/views/hyrax/base/_representative_media.html.erb +1 -1
  176. data/app/views/hyrax/base/_show_actions.html.erb +2 -2
  177. data/app/views/hyrax/base/_work_button_row.html.erb +1 -1
  178. data/app/views/hyrax/batch_uploads/_form.html.erb +1 -1
  179. data/app/views/hyrax/collections/show.html.erb +1 -1
  180. data/app/views/hyrax/dashboard/collections/_collection_title.html.erb +1 -1
  181. data/app/views/hyrax/dashboard/collections/_form.html.erb +4 -4
  182. data/app/views/hyrax/dashboard/collections/_form_branding.html.erb +1 -1
  183. data/app/views/hyrax/dashboard/collections/_list_collections.html.erb +1 -1
  184. data/app/views/hyrax/dashboard/collections/_sort_and_per_page.html.erb +1 -1
  185. data/app/views/hyrax/dashboard/collections/edit.html.erb +4 -2
  186. data/app/views/hyrax/dashboard/collections/new.html.erb +4 -2
  187. data/app/views/hyrax/dashboard/collections/show.html.erb +1 -1
  188. data/app/views/hyrax/file_sets/_actions.html.erb +10 -0
  189. data/app/views/hyrax/file_sets/edit.html.erb +1 -1
  190. data/app/views/hyrax/file_sets/media_display/_audio.html.erb +1 -1
  191. data/app/views/hyrax/file_sets/media_display/_default.html.erb +1 -1
  192. data/app/views/hyrax/file_sets/media_display/_image.html.erb +1 -1
  193. data/app/views/hyrax/file_sets/media_display/_office_document.html.erb +1 -1
  194. data/app/views/hyrax/file_sets/media_display/_pdf.html.erb +1 -1
  195. data/app/views/hyrax/file_sets/media_display/_video.html.erb +1 -1
  196. data/app/views/hyrax/file_sets/show.html.erb +1 -1
  197. data/app/views/hyrax/homepage/index.html.erb +1 -1
  198. data/app/views/hyrax/my/_admin_set_action_menu.html.erb +0 -11
  199. data/app/views/hyrax/my/_collection_action_menu.html.erb +1 -2
  200. data/app/views/hyrax/my/collections/_list_collections.html.erb +1 -1
  201. data/app/views/hyrax/my/collections/_modal_add_subcollection.html.erb +3 -5
  202. data/app/views/hyrax/my/collections/_modal_collection_types_to_create.html.erb +1 -1
  203. data/app/views/layouts/hyrax/dashboard.html.erb +1 -0
  204. data/app/views/layouts/hyrax.html.erb +1 -0
  205. data/app/views/shared/_read_only.html.erb +5 -0
  206. data/bin/db-migrate-seed.sh +3 -1
  207. data/bin/hyrax-entrypoint.sh +0 -14
  208. data/bin/solrcloud-assign-configset.sh +11 -3
  209. data/bin/solrcloud-upload-configset.sh +17 -6
  210. data/chart/hyrax/Chart.yaml +9 -5
  211. data/chart/hyrax/README.md +52 -5
  212. data/chart/hyrax/templates/_helpers.tpl +23 -1
  213. data/chart/hyrax/templates/branding-pvc.yaml +14 -0
  214. data/chart/hyrax/templates/configmap-env.yaml +14 -3
  215. data/chart/hyrax/templates/deployment-worker.yaml +129 -0
  216. data/chart/hyrax/templates/deployment.yaml +95 -0
  217. data/chart/hyrax/templates/derivatives-pvc.yaml +14 -0
  218. data/chart/hyrax/templates/ingress.yaml +13 -4
  219. data/chart/hyrax/templates/secrets.yaml +9 -0
  220. data/chart/hyrax/templates/uploads-pvc.yaml +14 -0
  221. data/chart/hyrax/values.yaml +114 -1
  222. data/config/brakeman.ignore +2 -2
  223. data/config/features.rb +50 -43
  224. data/config/initializers/1_healthz.rb +1 -0
  225. data/config/initializers/listeners.rb +4 -1
  226. data/config/initializers/valkryrie_storage.rb +7 -0
  227. data/config/locales/hyrax.de.yml +1 -1
  228. data/config/locales/hyrax.en.yml +2 -1
  229. data/config/locales/hyrax.es.yml +1 -1
  230. data/config/locales/hyrax.fr.yml +1 -1
  231. data/config/locales/hyrax.it.yml +1 -1
  232. data/config/locales/hyrax.pt-BR.yml +1 -1
  233. data/config/locales/hyrax.zh.yml +1 -1
  234. data/db/seeds.rb +1 -1
  235. data/docker-compose.yml +39 -8
  236. data/documentation/developing-your-hyrax-based-app.md +3 -3
  237. data/documentation/legacyREADME.md +3 -3
  238. data/hyrax.gemspec +1 -1
  239. data/lib/generators/hyrax/templates/catalog_controller.rb +3 -1
  240. data/lib/generators/hyrax/templates/config/initializers/hyrax.rb +15 -0
  241. data/lib/generators/hyrax/templates/config/initializers/riiif.rb +22 -20
  242. data/lib/generators/hyrax/work/templates/feature_spec.rb.erb +1 -1
  243. data/lib/generators/hyrax/work_resource/templates/indexer_spec.rb.erb +1 -0
  244. data/lib/hyrax/active_fedora_dummy_model.rb +62 -0
  245. data/lib/hyrax/collection_name.rb +6 -2
  246. data/lib/hyrax/configuration.rb +56 -0
  247. data/lib/hyrax/engine.rb +3 -1
  248. data/lib/hyrax/errors.rb +2 -0
  249. data/lib/hyrax/form_fields.rb +1 -0
  250. data/lib/hyrax/publisher.rb +12 -0
  251. data/lib/hyrax/resource_name.rb +1 -0
  252. data/lib/hyrax/resource_sync/change_list_writer.rb +2 -2
  253. data/lib/hyrax/resource_sync/resource_list_writer.rb +2 -2
  254. data/lib/hyrax/specs/capybara.rb +5 -3
  255. data/lib/hyrax/specs/shared_specs/hydra_works.rb +2 -0
  256. data/lib/hyrax/specs/shared_specs/indexers.rb +6 -0
  257. data/lib/hyrax/specs/shared_specs/valkyrie_storage_versions.rb +9 -0
  258. data/lib/hyrax/transactions/collection_create.rb +25 -0
  259. data/lib/hyrax/transactions/collection_update.rb +20 -0
  260. data/lib/hyrax/transactions/container.rb +47 -0
  261. data/lib/hyrax/transactions/file_set_destroy.rb +21 -0
  262. data/lib/hyrax/transactions/steps/add_file_sets.rb +3 -2
  263. data/lib/hyrax/transactions/steps/add_to_collections.rb +13 -1
  264. data/lib/hyrax/transactions/steps/add_to_parent.rb +36 -0
  265. data/lib/hyrax/transactions/steps/apply_collection_type_permissions.rb +29 -0
  266. data/lib/hyrax/transactions/steps/remove_file_set_from_work.rb +47 -0
  267. data/lib/hyrax/transactions/steps/save.rb +18 -6
  268. data/lib/hyrax/transactions/steps/set_collection_type_gid.rb +35 -0
  269. data/lib/hyrax/transactions/work_create.rb +2 -1
  270. data/lib/hyrax/valkyrie_can_can_adapter.rb +3 -0
  271. data/lib/hyrax/valkyrie_simple_path_generator.rb +20 -0
  272. data/lib/hyrax/version.rb +1 -1
  273. data/lib/hyrax.rb +9 -0
  274. data/lib/tasks/collection_type_global_id.rake +1 -1
  275. data/lib/tasks/default_admin_set.rake +12 -11
  276. data/lib/tasks/regenerate_derivatives.rake +12 -0
  277. data/lib/wings/active_fedora_converter/default_work.rb +15 -0
  278. data/lib/wings/converter_value_mapper.rb +2 -2
  279. data/lib/wings/model_transformer.rb +17 -1
  280. data/lib/wings/orm_converter.rb +18 -2
  281. data/lib/wings/setup.rb +2 -0
  282. data/lib/wings/valkyrie/persister.rb +7 -5
  283. data/lib/wings/valkyrie/query_service.rb +60 -17
  284. data/lib/wings/valkyrie/storage.rb +56 -1
  285. data/lib/wings.rb +0 -21
  286. data/template.rb +1 -1
  287. metadata +42 -9
@@ -26,90 +26,112 @@ module Hyrax
26
26
 
27
27
  private
28
28
 
29
- def registered_ingest_dirs
30
- Hyrax.config.registered_ingest_dirs
29
+ def attach_files(env, remote_files)
30
+ ingest_remote_files_service_class.new(user: env.user,
31
+ curation_concern: env.curation_concern,
32
+ remote_files: remote_files,
33
+ file_set_actor_class: file_set_actor_class).attach!
31
34
  end
32
35
 
33
- # @param uri [URI] the uri fo the resource to import
34
- def validate_remote_url(uri)
35
- if uri.scheme == 'file'
36
- path = File.absolute_path(CGI.unescape(uri.path))
37
- registered_ingest_dirs.any? do |dir|
38
- path.start_with?(dir) && path.length > dir.length
36
+ class IngestRemoteFilesService
37
+ ##
38
+ # @parm user [User]
39
+ # @parm curation_concern [Hyrax::Work]
40
+ # @param remote_files [HashWithIndifferentAccess]
41
+ # @param file_set_actor_class
42
+ # @param ordered_members [Array]
43
+ # @param ordered [Boolean]
44
+ # rubocop:disable Metrics/ParameterLists
45
+ def initialize(user:, curation_concern:, remote_files:, file_set_actor_class:, ordered_members: [], ordered: false)
46
+ @remote_files = remote_files
47
+ @user = user
48
+ @curation_concern = curation_concern
49
+ @file_set_actor_class = file_set_actor_class
50
+ @ordered_members = ordered_members
51
+ @ordered = ordered
52
+ end
53
+ # rubocop:enable Metrics/ParameterLists
54
+ attr_reader :remote_files, :user, :curation_concern, :ordered_members, :ordered, :file_set_actor_class
55
+
56
+ ##
57
+ # @return true
58
+ def attach!
59
+ return true unless remote_files
60
+ remote_files.each do |file_info|
61
+ next if file_info.blank? || file_info[:url].blank?
62
+ # Escape any space characters, so that this is a legal URI
63
+ uri = URI.parse(Addressable::URI.escape(file_info[:url]))
64
+ unless self.class.validate_remote_url(uri)
65
+ Rails.logger.error "User #{user.user_key} attempted to ingest file from url #{file_info[:url]}, which doesn't pass validation"
66
+ return false
67
+ end
68
+ auth_header = file_info.fetch(:auth_header, {})
69
+ create_file_from_url(uri, file_info[:file_name], auth_header)
39
70
  end
40
- else
41
- Rails.logger.debug "Assuming #{uri.scheme} uri is valid without a serious attempt to validate: #{uri}"
71
+ add_ordered_members! if ordered
42
72
  true
43
73
  end
44
- end
45
74
 
46
- # @param [HashWithIndifferentAccess] remote_files
47
- # @return [TrueClass]
48
- def attach_files(env, remote_files)
49
- return true unless remote_files
50
- remote_files.each do |file_info|
51
- next if file_info.blank? || file_info[:url].blank?
52
- # Escape any space characters, so that this is a legal URI
53
- uri = URI.parse(Addressable::URI.escape(file_info[:url]))
54
- unless validate_remote_url(uri)
55
- Rails.logger.error "User #{env.user.user_key} attempted to ingest file from url #{file_info[:url]}, which doesn't pass validation"
56
- return false
75
+ def self.registered_ingest_dirs
76
+ Hyrax.config.registered_ingest_dirs
77
+ end
78
+
79
+ # @param uri [URI] the uri fo the resource to import
80
+ def self.validate_remote_url(uri)
81
+ if uri.scheme == 'file'
82
+ path = File.absolute_path(CGI.unescape(uri.path))
83
+ registered_ingest_dirs.any? do |dir|
84
+ path.start_with?(dir) && path.length > dir.length
85
+ end
86
+ else
87
+ Rails.logger.debug "Assuming #{uri.scheme} uri is valid without a serious attempt to validate: #{uri}"
88
+ true
57
89
  end
58
- auth_header = file_info.fetch(:auth_header, {})
59
- create_file_from_url(env, uri, file_info[:file_name], auth_header)
60
90
  end
61
- true
62
- end
63
91
 
64
- def create_file_from_url(env, uri, file_name, auth_header)
65
- case env.curation_concern
66
- when Valkyrie::Resource
67
- create_file_from_url_through_valkyrie(env, uri, file_name, auth_header)
68
- else
69
- create_file_from_url_through_active_fedora(env, uri, file_name, auth_header)
92
+ private
93
+
94
+ def create_file_from_url(uri, file_name, auth_header)
95
+ import_url = URI.decode_www_form_component(uri.to_s)
96
+ use_valkyrie = false
97
+ case curation_concern
98
+ when Valkyrie::Resource
99
+ file_set = Hyrax.persister.save(resource: Hyrax::FileSet.new(import_url: import_url, label: file_name))
100
+ use_valkyrie = true
101
+ else
102
+ file_set = ::FileSet.new(import_url: import_url, label: file_name)
103
+ end
104
+ __create_file_from_url(file_set: file_set, uri: uri, auth_header: auth_header, use_valkyrie: use_valkyrie)
70
105
  end
71
- end
72
106
 
73
- # Generic utility for creating FileSet from a URL
74
- # Used in to import files using URLs from a file picker like browse_everything
75
- def create_file_from_url_through_active_fedora(env, uri, file_name, auth_header)
76
- import_url = URI.decode_www_form_component(uri.to_s)
77
- ::FileSet.new(import_url: import_url, label: file_name) do |fs|
78
- actor = Hyrax::Actors::FileSetActor.new(fs, env.user)
79
- actor.create_metadata(visibility: env.curation_concern.visibility)
80
- actor.attach_to_work(env.curation_concern)
81
- fs.save!
107
+ def __create_file_from_url(file_set:, uri:, auth_header:, use_valkyrie: Hyrax.config.use_valkyrie?)
108
+ actor = file_set_actor_class.new(file_set, user, use_valkyrie: use_valkyrie)
109
+ actor.create_metadata(visibility: curation_concern.visibility)
110
+ actor.attach_to_work(curation_concern)
111
+ file_set.save! if file_set.respond_to?(:save!)
112
+ # We'll remember the order, but if it's not `@ordered` we won't do anything.
113
+ ordered_members << file_set
82
114
  if uri.scheme == 'file'
83
115
  # Turn any %20 into spaces.
84
116
  file_path = CGI.unescape(uri.path)
85
- IngestLocalFileJob.perform_later(fs, file_path, env.user)
117
+ IngestLocalFileJob.perform_later(file_set, file_path, user)
86
118
  else
87
- ImportUrlJob.perform_later(fs, operation_for(user: actor.user), auth_header)
119
+ ImportUrlJob.perform_later(file_set, operation_for(user: user), auth_header)
88
120
  end
89
121
  end
90
- end
91
122
 
92
- # Generic utility for creating Hyrax::FileSet from a URL
93
- # Used in to import files using URLs from a file picker like browse_everything
94
- def create_file_from_url_through_valkyrie(env, uri, file_name, auth_header)
95
- import_url = URI.decode_www_form_component(uri.to_s)
96
- fs = Hyrax.persister.save(resource: Hyrax::FileSet.new(import_url: import_url, label: file_name))
97
- actor = Hyrax::Actors::FileSetActor.new(fs, env.user, use_valkyrie: true)
98
- actor.create_metadata(visibility: env.curation_concern.visibility)
99
- actor.attach_to_work(env.curation_concern)
100
- if uri.scheme == 'file'
101
- # Turn any %20 into spaces.
102
- file_path = CGI.unescape(uri.path)
103
- IngestLocalFileJob.perform_later(fs, file_path, env.user)
104
- else
105
- ImportUrlJob.perform_later(fs, operation_for(user: actor.user), auth_header)
123
+ def operation_for(user:)
124
+ Hyrax::Operation.create!(user: user,
125
+ operation_type: "Attach Remote File")
106
126
  end
107
- end
108
127
 
109
- def operation_for(user:)
110
- Hyrax::Operation.create!(user: user,
111
- operation_type: "Attach Remote File")
128
+ def add_ordered_members!
129
+ actor = Hyrax::Actors::OrderedMembersActor.new(ordered_members, user)
130
+ actor.attach_ordered_members_to_work(curation_concern)
131
+ end
112
132
  end
133
+ class_attribute :file_set_actor_class, default: ::Hyrax::Actors::FileSetActor
134
+ class_attribute :ingest_remote_files_service_class, default: ::Hyrax::Actors::CreateWithRemoteFilesActor::IngestRemoteFilesService
113
135
  end
114
136
  end
115
137
  end
@@ -39,54 +39,19 @@ module Hyrax
39
39
  # url property, it may have spaces, and not be a valid URI.
40
40
  class CreateWithRemoteFilesOrderedMembersActor < CreateWithRemoteFilesActor
41
41
  attr_reader :ordered_members
42
+ self.file_set_actor_class = Hyrax::Actors::FileSetOrderedMembersActor
42
43
 
43
44
  # @param [HashWithIndifferentAccess] remote_files
44
45
  # @return [TrueClass]
45
46
  def attach_files(env, remote_files)
46
- return true unless remote_files
47
47
  @ordered_members = env.curation_concern.ordered_members.to_a
48
- remote_files.each do |file_info|
49
- next if file_info.blank? || file_info[:url].blank?
50
- # Escape any space characters, so that this is a legal URI
51
- uri = URI.parse(Addressable::URI.escape(file_info[:url]))
52
- unless validate_remote_url(uri)
53
- Rails.logger.error "User #{env.user.user_key} attempted to ingest file from url #{file_info[:url]}, which doesn't pass validation"
54
- return false
55
- end
56
- auth_header = file_info.fetch(:auth_header, {})
57
- create_file_from_url(env, uri, file_info[:file_name], auth_header)
58
- end
59
- add_ordered_members(env.user, env.curation_concern)
60
- true
61
- end
62
-
63
- # Generic utility for creating FileSet from a URL
64
- # Used in to import files using URLs from a file picker like browse_everything
65
- def create_file_from_url(env, uri, file_name, auth_header = {})
66
- ::FileSet.new(import_url: uri.to_s, label: file_name) do |fs|
67
- actor = file_set_actor_class.new(fs, env.user)
68
- actor.create_metadata(visibility: env.curation_concern.visibility)
69
- actor.attach_to_work(env.curation_concern)
70
- fs.save!
71
- ordered_members << fs
72
- if uri.scheme == 'file'
73
- # Turn any %20 into spaces.
74
- file_path = CGI.unescape(uri.path)
75
- IngestLocalFileJob.perform_later(fs, file_path, env.user)
76
- else
77
- ImportUrlJob.perform_later(fs, operation_for(user: actor.user), auth_header)
78
- end
79
- end
48
+ ingest_remote_files_service_class.new(user: env.user,
49
+ curation_concern: env.curation_concern,
50
+ remote_files: remote_files,
51
+ ordered_members: @ordered_members,
52
+ ordered: true,
53
+ file_set_actor_class: file_set_actor_class).attach!
80
54
  end
81
-
82
- # Add all file_sets as ordered_members in a single action
83
- def add_ordered_members(user, work)
84
- actor = Hyrax::Actors::OrderedMembersActor.new(ordered_members, user)
85
- actor.attach_ordered_members_to_work(work)
86
- end
87
-
88
- class_attribute :file_set_actor_class
89
- self.file_set_actor_class = Hyrax::Actors::FileSetOrderedMembersActor
90
55
  end
91
56
  end
92
57
  end
@@ -31,10 +31,9 @@ module Hyrax
31
31
  # hand. Do this because we don't have the underlying UploadedFile instance
32
32
  file_actor = build_file_actor(relation)
33
33
  file_actor.ingest_file(wrapper!(file: file, relation: relation))
34
- # Copy visibility and permissions from parent (work) to
35
- # FileSets even if they come in from BrowseEverything
36
- VisibilityCopyJob.perform_later(file_set.parent)
37
- InheritPermissionsJob.perform_later(file_set.parent)
34
+ parent = parent_for(file_set: file_set)
35
+ VisibilityCopyJob.perform_later(parent)
36
+ InheritPermissionsJob.perform_later(parent)
38
37
  else
39
38
  IngestJob.perform_later(wrapper!(file: file, relation: relation))
40
39
  end
@@ -138,6 +137,12 @@ module Hyrax
138
137
  @ability ||= ::Ability.new(user)
139
138
  end
140
139
 
140
+ # @param file_set [FileSet]
141
+ # @return [ActiveFedora::Base]
142
+ def parent_for(file_set:)
143
+ file_set.parent
144
+ end
145
+
141
146
  def build_file_actor(relation)
142
147
  fs = use_valkyrie ? file_set.valkyrie_resource : file_set
143
148
  file_actor_class.new(fs, relation, user, use_valkyrie: use_valkyrie)
@@ -160,6 +165,8 @@ module Hyrax
160
165
  elsif file_set.import_url.present?
161
166
  # This path is taken when file is a Tempfile (e.g. from ImportUrlJob)
162
167
  File.basename(Addressable::URI.unencode(file.file_url))
168
+ elsif file.respond_to?(:original_filename) # e.g. Rack::Test::UploadedFile
169
+ file.original_filename
163
170
  else
164
171
  File.basename(file)
165
172
  end
@@ -179,7 +186,7 @@ module Hyrax
179
186
  # Although ActiveFedora clears the children nodes it leaves those fields in Solr populated.
180
187
  # rubocop:disable Metrics/CyclomaticComplexity
181
188
  def unlink_from_work
182
- work = file_set.parent
189
+ work = parent_for(file_set: file_set)
183
190
  return unless work && (work.thumbnail_id == file_set.id || work.representative_id == file_set.id || work.rendering_ids.include?(file_set.id))
184
191
  work.thumbnail = nil if work.thumbnail_id == file_set.id
185
192
  work.representative = nil if work.representative_id == file_set.id
@@ -72,3 +72,8 @@ label.disabled {
72
72
  }
73
73
  }
74
74
  }
75
+
76
+ .read-only {
77
+ font-size: 1.2em;
78
+ margin: 0 0 10px;
79
+ }
@@ -15,18 +15,21 @@ module Hyrax
15
15
  class_attribute :presenter_class,
16
16
  :form_class,
17
17
  :single_item_search_builder_class,
18
- :membership_service_class
18
+ :membership_service_class,
19
+ :parent_collection_query_service
19
20
 
20
21
  self.presenter_class = Hyrax::CollectionPresenter
21
22
 
22
23
  # The search builder to find the collection
23
24
  self.single_item_search_builder_class = SingleCollectionSearchBuilder
24
25
  # The search builder to find the collections' members
25
- self.membership_service_class = Collections::CollectionMemberService
26
+ self.membership_service_class = Collections::CollectionMemberSearchService
27
+ # A search service to use in finding parent collections
28
+ self.parent_collection_query_service = Collections::NestedCollectionQueryService
26
29
  end
27
30
 
28
31
  def show
29
- @curation_concern ||= Hyrax.query_service.find_by_alternate_identifier(alternate_identifier: params[:id])
32
+ @curation_concern = @collection # we must populate curation_concern
30
33
  presenter
31
34
  query_collection_members
32
35
  end
@@ -74,9 +77,9 @@ module Hyrax
74
77
  end
75
78
 
76
79
  def query_collection_members
77
- member_works
78
- member_subcollections if collection.collection_type.nestable?
79
- parent_collections if collection.collection_type.nestable? && action_name == 'show'
80
+ load_member_works
81
+ load_member_subcollections if collection.collection_type.nestable?
82
+ load_parent_collections if collection.collection_type.nestable? && action_name == 'show'
80
83
  end
81
84
 
82
85
  # Instantiate the membership query service
@@ -89,15 +92,31 @@ module Hyrax
89
92
  @member_docs = @response.documents
90
93
  @members_count = @response.total
91
94
  end
95
+ alias load_member_works member_works
92
96
 
93
- def parent_collections
97
+ ##
98
+ # Handles paged loading for parent collections.
99
+ #
100
+ # @param the query service to use when searching for the parent collections.
101
+ # uses the class attribute +parent_collection_query_service+ by default.
102
+ def parent_collections(query_service: self.class.parent_collection_query_service)
94
103
  page = params[:parent_collection_page].to_i
95
- query = Hyrax::Collections::NestedCollectionQueryService
96
- collection.parent_collections = query.parent_collections(child: collection_object, scope: self, page: page)
104
+
105
+ collection.parent_collections =
106
+ query_service.parent_collections(child: collection_object,
107
+ scope: self,
108
+ page: page)
97
109
  end
110
+ alias load_parent_collections parent_collections
98
111
 
112
+ ##
113
+ # @note this is here because, though we want to load and authorize the real
114
+ # collection for show views, for apparently historical reasons,
115
+ # {#collection} is overridden to access `@presenter`. this should probably
116
+ # be deprecated and callers encouraged to use `@collection` but the scope
117
+ # and impact of that change needs more evaluation.
99
118
  def collection_object
100
- action_name == 'show' ? Collection.find(collection.id) : collection
119
+ action_name == 'show' ? @collection : collection
101
120
  end
102
121
 
103
122
  def member_subcollections
@@ -106,6 +125,7 @@ module Hyrax
106
125
  @subcollection_docs = results.documents
107
126
  @subcollection_count = @presenter.subcollection_count = results.total
108
127
  end
128
+ alias load_member_subcollections member_subcollections
109
129
 
110
130
  # You can override this method if you need to provide additional inputs to the search
111
131
  # builder. For example:
@@ -16,6 +16,7 @@ module Hyrax::Controller
16
16
  include Hydra::Controller::ControllerBehavior
17
17
  helper_method :create_work_presenter
18
18
  before_action :set_locale
19
+ before_action :check_read_only, except: [:show, :index]
19
20
  end
20
21
 
21
22
  # Provide a place for Devise to send the user to after signing in
@@ -34,12 +35,14 @@ module Hyrax::Controller
34
35
  # @api public
35
36
  #
36
37
  # @return [#[]] a resolver for Hyrax's Transactions; this *should* be a
37
- # thread-safe Dry::Container, but callers to this method should strictly
38
- # use #[] for access
38
+ # thread-safe {Dry::Container}, but callers to this method should strictly
39
+ # use +#[]+ for access.
39
40
  #
40
41
  # @example
41
42
  # transactions['change_set.create_work'].call(my_form)
42
43
  #
44
+ # @see Hyrax::Transactions::Container
45
+ # @see Hyrax::Transactions::Transaction
43
46
  # @see https://dry-rb.org/gems/dry-container
44
47
  def transactions
45
48
  Hyrax::Transactions::Container
@@ -88,4 +91,12 @@ module Hyrax::Controller
88
91
  wants.json { render_json_response(response_type: :unauthorized, message: json_message) }
89
92
  end
90
93
  end
94
+
95
+ # Redirect all deposit and edit requests with warning message when in read only mode
96
+ def check_read_only
97
+ return unless Flipflop.read_only?
98
+ # Allows feature to be turned off
99
+ return if self.class.to_s == Hyrax::Admin::StrategiesController.to_s
100
+ redirect_to root_path, flash: { error: t('hyrax.read_only') }
101
+ end
91
102
  end
@@ -24,23 +24,35 @@ module Hyrax
24
24
  end
25
25
 
26
26
  # Updates a batch of embargos
27
+ # rubocop:disable Metrics/AbcSize
28
+ # rubocop:disable Metrics/MethodLength
29
+ # rubocop:disable Metrics/PerceivedComplexity
27
30
  def update
28
31
  filter_docs_with_edit_access!
29
32
  copy_visibility = []
30
33
  copy_visibility = params[:embargoes].values.map { |h| h[:copy_visibility] } if params[:embargoes]
31
- af_objects = Hyrax.custom_queries.find_many_by_alternate_ids(alternate_ids: batch, use_valkyrie: false)
32
- af_objects.each do |curation_concern|
33
- Hyrax::Actors::EmbargoActor.new(curation_concern).destroy
34
- # if the concern is a FileSet, set its visibility and visibility propagation
35
- if curation_concern.file_set?
36
- curation_concern.visibility = curation_concern.to_solr["visibility_after_embargo_ssim"]
37
- curation_concern.save!
38
- elsif copy_visibility.include?(curation_concern.id)
39
- Hyrax::VisibilityPropagator.for(source: curation_concern).propagate
34
+ resources = Hyrax.custom_queries.find_many_by_alternate_ids(alternate_ids: batch, use_valkyrie: Hyrax.config.use_valkyrie?)
35
+ resources.each do |resource|
36
+ if Hyrax.config.use_valkyrie?
37
+ EmbargoManager.new(resource: resource).release!
38
+ Hyrax::AccessControlList(resource).save
39
+ Hyrax::VisibilityPropagator.for(source: resource).propagate if copy_visibility.include?(resource.id)
40
+ else
41
+ Hyrax::Actors::EmbargoActor.new(resource).destroy
42
+ # if the concern is a FileSet, set its visibility and visibility propagation
43
+ if resource.file_set?
44
+ resource.visibility = resource.to_solr["visibility_after_embargo_ssim"]
45
+ resource.save!
46
+ elsif copy_visibility.include?(resource.id)
47
+ Hyrax::VisibilityPropagator.for(source: resource).propagate
48
+ end
40
49
  end
41
50
  end
42
51
  redirect_to embargoes_path, notice: t('.embargo_deactivated')
43
52
  end
53
+ # rubocop:enable Metrics/AbcSize
54
+ # rubocop:enable Metrics/MethodLength
55
+ # rubocop:enable Metrics/PerceivedComplexity
44
56
 
45
57
  # This allows us to use the unauthorized template in curation_concerns/base
46
58
  def self.local_prefixes
@@ -23,18 +23,27 @@ module Hyrax
23
23
  end
24
24
  end
25
25
 
26
+ # rubocop:disable Metrics/AbcSize
27
+ # rubocop:disable Metrics/MethodLength
26
28
  def update
27
29
  filter_docs_with_edit_access!
28
30
  copy_visibility = []
29
31
  copy_visibility = params[:leases].values.map { |h| h[:copy_visibility] } if params[:leases]
30
- af_objects = Hyrax.custom_queries.find_many_by_alternate_ids(alternate_ids: batch, use_valkyrie: false)
31
- af_objects.each do |curation_concern|
32
- Hyrax::Actors::LeaseActor.new(curation_concern).destroy
33
- Hyrax::VisibilityPropagator.for(source: curation_concern).propagate if
34
- copy_visibility.include?(curation_concern.id)
32
+ resources = Hyrax.custom_queries.find_many_by_alternate_ids(alternate_ids: batch, use_valkyrie: Hyrax.config.use_valkyrie?)
33
+ resources.each do |resource|
34
+ if Hyrax.config.use_valkyrie?
35
+ LeaseManager.new(resource: resource).release!
36
+ Hyrax::AccessControlList(resource).save
37
+ else
38
+ Hyrax::Actors::LeaseActor.new(resource).destroy
39
+ end
40
+ Hyrax::VisibilityPropagator.for(source: resource).propagate if
41
+ copy_visibility.include?(resource.id)
35
42
  end
36
43
  redirect_to leases_path
37
44
  end
45
+ # rubocop:enable Metrics/AbcSize
46
+ # rubocop:enable Metrics/MethodLength
38
47
 
39
48
  # This allows us to use the unauthorized template in curation_concerns/base
40
49
  def self.local_prefixes
@@ -47,6 +47,7 @@ module Hyrax
47
47
  end
48
48
 
49
49
  def new
50
+ @admin_set_options = available_admin_sets
50
51
  # TODO: move these lines to the work form builder in Hyrax
51
52
  curation_concern.depositor = current_user.user_key
52
53
  curation_concern.admin_set_id = admin_set_id_for_new
@@ -95,6 +96,7 @@ module Hyrax
95
96
  # rubocop:enable Metrics/AbcSize
96
97
 
97
98
  def edit
99
+ @admin_set_options = available_admin_sets
98
100
  build_form
99
101
  end
100
102
 
@@ -203,7 +205,8 @@ module Hyrax
203
205
  @curation_concern =
204
206
  form.validate(params[hash_key_for_curation_concern]) &&
205
207
  transactions['change_set.create_work']
206
- .with_step_args('work_resource.add_file_sets' => { uploaded_files: uploaded_files },
208
+ .with_step_args('work_resource.add_to_parent' => { parent_id: params[:parent_id], user: current_user },
209
+ 'work_resource.add_file_sets' => { uploaded_files: uploaded_files, file_set_params: params[hash_key_for_curation_concern][:file_set] },
207
210
  'change_set.set_user_as_depositor' => { user: current_user })
208
211
  .call(form).value!
209
212
  end
@@ -219,7 +222,7 @@ module Hyrax
219
222
  @curation_concern =
220
223
  form.validate(params[hash_key_for_curation_concern]) &&
221
224
  transactions['change_set.update_work']
222
- .with_step_args('work_resource.add_file_sets' => { uploaded_files: uploaded_files })
225
+ .with_step_args('work_resource.add_file_sets' => { uploaded_files: uploaded_files, file_set_params: params[hash_key_for_curation_concern][:file_set] })
223
226
  .call(form).value!
224
227
  end
225
228
  end
@@ -255,7 +258,7 @@ module Hyrax
255
258
 
256
259
  # @deprecated
257
260
  def curation_concern_from_search_results
258
- Deprecation.warn("'##{__method__}' will be removed in Hyrax 4.0. " /
261
+ Deprecation.warn("'##{__method__}' will be removed in Hyrax 4.0. " \
259
262
  "Instead, use '#search_result_document'.")
260
263
  search_params = params.deep_dup
261
264
  search_params.delete :page
@@ -436,5 +439,21 @@ module Hyrax
436
439
  def uploaded_files
437
440
  UploadedFile.find(params.fetch(:uploaded_files, []))
438
441
  end
442
+
443
+ def available_admin_sets
444
+ admin_set_results = Hyrax::AdminSetService.new(self).search_results(:deposit)
445
+ # get all the templates at once, reducing query load
446
+ templates = PermissionTemplate.where(id: admin_set_results.map(&:id)).to_a
447
+
448
+ admin_sets = admin_set_results.map do |admin_set_doc|
449
+ template = templates.find { |temp| temp.source_id == admin_set_doc.id.to_s }
450
+ sharing = can?(:manage, template) || !!template&.active_workflow&.allows_access_grant?
451
+
452
+ AdminSetSelectionPresenter::OptionsEntry
453
+ .new(admin_set: admin_set_doc, permission_template: template, permit_sharing: sharing)
454
+ end
455
+
456
+ AdminSetSelectionPresenter.new(admin_sets: admin_sets)
457
+ end
439
458
  end
440
459
  end
@@ -4,9 +4,7 @@ module Hyrax
4
4
  include Hyrax::CollectionsControllerBehavior
5
5
 
6
6
  before_action :authenticate_user!
7
- before_action :ensure_manager!, except: [:show]
8
7
  load_and_authorize_resource
9
- before_action :ensure_viewer!, only: [:show]
10
8
 
11
9
  # Catch permission errors
12
10
  rescue_from Hydra::AccessDenied, CanCan::AccessDenied, with: :deny_adminset_access
@@ -43,10 +41,8 @@ module Hyrax
43
41
  end
44
42
 
45
43
  def index
46
- add_breadcrumb t(:'hyrax.controls.home'), root_path
47
- add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path
48
- add_breadcrumb t(:'hyrax.admin.sidebar.admin_sets'), hyrax.admin_admin_sets_path
49
- @admin_sets = Hyrax::AdminSetService.new(self).search_results(:edit)
44
+ # admin sets are listed with collections
45
+ redirect_to hyrax.my_collections_url
50
46
  end
51
47
 
52
48
  def new
@@ -106,19 +102,6 @@ module Hyrax
106
102
  hyrax.edit_admin_admin_set_path(@admin_set) + (params[:referer_anchor] || '')
107
103
  end
108
104
 
109
- def ensure_manager!
110
- # TODO: Review for possible removal. Doesn't appear to apply anymore.
111
- # Even though the user can view this admin set, they may not be able to view
112
- # it on the admin page.
113
- authorize! :manage_any, AdminSet
114
- end
115
-
116
- def ensure_viewer!
117
- # Even though the user can view this admin set, they may not be able to view
118
- # it on the admin page if access is granted as a public or registered user only.
119
- authorize! :view_admin_show, @admin_set
120
- end
121
-
122
105
  def create_admin_set
123
106
  admin_set_create_service.call(admin_set: @admin_set, creating_user: current_user)
124
107
  end
@@ -30,16 +30,12 @@ module Hyrax
30
30
  false
31
31
  end
32
32
 
33
- def update_access(manage_changed:)
34
- permission_template_form.update_access(manage_changed: manage_changed)
35
- end
36
-
37
33
  def after_destroy_success
38
34
  if source.admin_set?
39
35
  redirect_to hyrax.edit_admin_admin_set_path(source_id,
40
36
  anchor: 'participants'),
41
37
  notice: translate('participants', scope: 'hyrax.admin.admin_sets.form.permission_update_notices')
42
- elsif source.collection?
38
+ else
43
39
  redirect_to hyrax.edit_dashboard_collection_path(source_id,
44
40
  anchor: 'sharing'),
45
41
  notice: translate('sharing', scope: 'hyrax.dashboard.collections.form.permission_update_notices')
@@ -51,7 +47,7 @@ module Hyrax
51
47
  redirect_to hyrax.edit_admin_admin_set_path(source_id,
52
48
  anchor: 'participants'),
53
49
  alert: @permission_template_access.errors.full_messages.to_sentence
54
- elsif source.collection?
50
+ else
55
51
  redirect_to hyrax.edit_dashboard_collection_path(source_id,
56
52
  anchor: 'sharing'),
57
53
  alert: @permission_template_access.errors.full_messages.to_sentence
@@ -60,6 +56,9 @@ module Hyrax
60
56
 
61
57
  delegate :source_id, to: :permission_template
62
58
 
59
+ ##
60
+ # @todo can we avoid querying solr to deciede where to redirect? we
61
+ # otherwise don't need this data at all.
63
62
  def source
64
63
  @source ||= ::SolrDocument.find(source_id)
65
64
  end
@@ -15,8 +15,9 @@ module Hyrax
15
15
  add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path
16
16
  add_breadcrumb t(:'hyrax.admin.sidebar.tasks'), '#'
17
17
  add_breadcrumb t(:'hyrax.admin.sidebar.workflow_review'), request.path
18
- @status_list = Hyrax::Workflow::StatusListService.new(self, "-workflow_state_name_ssim:#{deposited_workflow_state_name}")
19
- @published_list = Hyrax::Workflow::StatusListService.new(self, "workflow_state_name_ssim:#{deposited_workflow_state_name}")
18
+
19
+ @status_list = actionable_objects.reject(&:published?)
20
+ @published_list = actionable_objects.select(&:published?)
20
21
  end
21
22
 
22
23
  private
@@ -24,5 +25,10 @@ module Hyrax
24
25
  def ensure_authorized!
25
26
  authorize! :review, :submissions
26
27
  end
28
+
29
+ def actionable_objects
30
+ @actionable_objects ||=
31
+ Hyrax::Workflow::ActionableObjects.new(user: current_user)
32
+ end
27
33
  end
28
34
  end