hyrax 1.0.0.rc1 → 1.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +3 -0
  3. data/.travis.yml +1 -0
  4. data/README.md +7 -1
  5. data/app/actors/hyrax/actors/file_set_actor.rb +22 -32
  6. data/app/assets/javascripts/hyrax/editor.es6 +1 -1
  7. data/app/assets/javascripts/hyrax/monkey_patch_turbolinks.js.coffee +8 -7
  8. data/app/assets/javascripts/hyrax/select_work_type.es6 +4 -0
  9. data/app/assets/stylesheets/hyrax/_dashboard.scss +10 -0
  10. data/app/assets/stylesheets/hyrax/_forms.scss +8 -0
  11. data/app/controllers/concerns/hyrax/controller.rb +2 -5
  12. data/app/controllers/hyrax/admin/workflow_roles_controller.rb +1 -1
  13. data/app/controllers/hyrax/workflow_actions_controller.rb +14 -4
  14. data/app/forms/hyrax/forms/permission_template_form.rb +38 -1
  15. data/app/forms/hyrax/forms/work_form.rb +16 -31
  16. data/app/forms/hyrax/forms/workflow_responsibility_form.rb +5 -2
  17. data/app/helpers/hyrax/hyrax_helper_behavior.rb +1 -1
  18. data/app/jobs/attach_files_to_work_job.rb +5 -15
  19. data/app/models/concerns/hyrax/naming.rb +1 -0
  20. data/app/models/hyrax/permission_template_access.rb +10 -10
  21. data/app/models/sipity/workflow.rb +30 -0
  22. data/app/presenters/hyrax/admin/workflow_role_presenter.rb +17 -31
  23. data/app/presenters/hyrax/admin/workflow_roles_presenter.rb +43 -0
  24. data/app/presenters/hyrax/collection_options_presenter.rb +30 -0
  25. data/app/presenters/hyrax/workflow_presenter.rb +2 -2
  26. data/app/search_builders/hyrax/active_works_search_builder.rb +13 -0
  27. data/app/search_builders/hyrax/my_works_search_builder.rb +9 -12
  28. data/app/search_builders/hyrax/works_search_builder.rb +7 -0
  29. data/app/services/hyrax/actor_factory.rb +1 -1
  30. data/app/services/hyrax/admin_set_create_service.rb +24 -2
  31. data/app/services/hyrax/form_metadata_service.rb +13 -0
  32. data/app/services/hyrax/persist_directly_contained_output_file_service.rb +3 -3
  33. data/app/services/hyrax/workflow/abstract_notification.rb +3 -1
  34. data/app/services/hyrax/workflow/activate_object.rb +1 -1
  35. data/app/services/hyrax/workflow/deactivate_object.rb +1 -1
  36. data/app/services/hyrax/workflow/grant_edit_to_depositor.rb +1 -1
  37. data/app/services/hyrax/workflow/grant_read_to_depositor.rb +13 -0
  38. data/app/services/hyrax/workflow/revoke_edit_from_depositor.rb +11 -0
  39. data/app/services/hyrax/workflow/workflow_schema.rb +1 -1
  40. data/app/views/catalog/_facet_limit.html.erb +5 -3
  41. data/app/views/hyrax/base/_form_visibility_component.html.erb +1 -0
  42. data/app/views/hyrax/homepage/index.html.erb +11 -4
  43. data/app/views/hyrax/my/_facet_limit.html.erb +11 -8
  44. data/app/views/hyrax/my/_index_partials/_default_group.html.erb +2 -1
  45. data/app/views/hyrax/my/_index_partials/_list_works.html.erb +1 -0
  46. data/config/locales/hyrax.en.yml +5 -0
  47. data/config/locales/hyrax.es.yml +8 -3
  48. data/config/locales/hyrax.zh.yml +730 -0
  49. data/hyrax.gemspec +5 -8
  50. data/lib/generators/hyrax/install_generator.rb +2 -3
  51. data/lib/generators/hyrax/models_generator.rb +1 -1
  52. data/lib/generators/hyrax/templates/catalog_controller.rb +37 -37
  53. data/lib/generators/hyrax/templates/config/locales/hyrax.en.yml +43 -0
  54. data/lib/generators/hyrax/templates/config/locales/hyrax.es.yml +43 -0
  55. data/lib/generators/hyrax/templates/config/locales/hyrax.zh.yml +55 -0
  56. data/lib/generators/hyrax/templates/mediated_deposit_workflow.json.erb +4 -1
  57. data/lib/generators/hyrax/work/templates/controller.rb.erb +1 -1
  58. data/lib/generators/hyrax/work/templates/feature_spec.rb.erb +12 -5
  59. data/lib/generators/hyrax/work/templates/locale.zh.yml.erb +10 -0
  60. data/lib/generators/hyrax/work/work_generator.rb +29 -13
  61. data/lib/hyrax/collections_migration.rb +18 -0
  62. data/lib/hyrax/engine.rb +1 -2
  63. data/lib/hyrax/errors.rb +11 -0
  64. data/lib/hyrax/rails/routes.rb +1 -1
  65. data/lib/hyrax/search_state.rb +1 -9
  66. data/lib/hyrax/specs/shared_specs.rb +1 -0
  67. data/lib/hyrax/specs/shared_specs/workflow_method.rb +46 -0
  68. data/lib/hyrax/version.rb +1 -1
  69. data/lib/tasks/migrate.rake +5 -0
  70. data/spec/controllers/hyrax/admin/workflow_roles_controller_spec.rb +3 -3
  71. data/spec/controllers/hyrax/batch_uploads_controller_spec.rb +1 -1
  72. data/spec/controllers/hyrax/workflow_actions_controller_spec.rb +18 -0
  73. data/spec/features/browse_catalog_spec.rb +1 -1
  74. data/spec/features/workflow_roles_spec.rb +1 -1
  75. data/spec/forms/hyrax/forms/work_form_spec.rb +19 -0
  76. data/spec/forms/hyrax/forms/workflow_responsibility_form_spec.rb +15 -7
  77. data/spec/helpers/blacklight_helper_spec.rb +1 -1
  78. data/spec/helpers/hyrax_helper_spec.rb +1 -1
  79. data/spec/jobs/attach_files_to_work_job_spec.rb +8 -14
  80. data/spec/lib/hyrax/collections_migration_spec.rb +34 -0
  81. data/spec/lib/hyrax/search_state_spec.rb +2 -2
  82. data/spec/models/hyrax/permission_template_spec.rb +1 -1
  83. data/spec/models/sipity/workflow_role_spec.rb +1 -0
  84. data/spec/presenters/hyrax/admin/workflow_role_presenter_spec.rb +8 -10
  85. data/spec/presenters/hyrax/admin/workflow_roles_presenter_spec.rb +18 -0
  86. data/spec/presenters/hyrax/collection_options_presenter_spec.rb +14 -0
  87. data/spec/search_builders/hyrax/active_works_search_builder_spec.rb +53 -0
  88. data/spec/search_builders/hyrax/works_search_builder_spec.rb +24 -0
  89. data/spec/services/hyrax/admin_set_create_service_spec.rb +64 -35
  90. data/spec/services/hyrax/persist_directly_contained_output_file_service_spec.rb +11 -7
  91. data/spec/services/hyrax/workflow/activate_object_spec.rb +4 -0
  92. data/spec/services/hyrax/workflow/changes_required_notification_spec.rb +2 -2
  93. data/spec/services/hyrax/workflow/deactivate_object_spec.rb +4 -0
  94. data/spec/services/hyrax/workflow/deposited_notification_spec.rb +2 -2
  95. data/spec/services/hyrax/workflow/grant_edit_to_depositor_spec.rb +4 -0
  96. data/spec/services/hyrax/workflow/pending_review_notification_spec.rb +2 -2
  97. data/spec/services/hyrax/workflow/revoke_edit_from_depositor_spec.rb +35 -0
  98. data/spec/support/controller_level_helpers.rb +1 -1
  99. data/spec/test_app_templates/lib/generators/test_app_generator.rb +10 -2
  100. data/spec/views/catalog/_index_list_default.html.erb_spec.rb +1 -2
  101. data/spec/views/hyrax/admin/workflow_roles/index.html.erb_spec.rb +2 -2
  102. data/spec/views/hyrax/homepage/index.html.erb_spec.rb +22 -2
  103. data/spec/views/shared/select_work_type_modal.html.erb_spec.rb +3 -3
  104. data/template.rb +1 -1
  105. metadata +34 -45
  106. data/lib/hyrax/single_use_error.rb +0 -3
  107. data/lib/hyrax/workflow_authorization_exception.rb +0 -4
@@ -17,7 +17,7 @@ module Hyrax
17
17
  # Which translations are available for the user to select
18
18
  # @return [Hash<String,String>] locale abbreviations as keys and flags as values
19
19
  def available_translations
20
- { 'en' => 'English', 'es' => 'Español' }
20
+ { 'en' => 'English', 'es' => 'Español', 'zh' => '中文' }
21
21
  end
22
22
 
23
23
  delegate :name, :name_full, to: :institution, prefix: :institution
@@ -21,24 +21,14 @@ class AttachFilesToWorkJob < ActiveJob::Base
21
21
  private
22
22
 
23
23
  # @param [Hyrax::Actors::FileSetActor] actor
24
- # @param [UploadedFileUploader] file
24
+ # @param [Hyrax::UploadedFileUploader] file file.file must be a CarrierWave::SanitizedFile or file.url must be present
25
25
  def attach_content(actor, file)
26
- case file.file
27
- when CarrierWave::SanitizedFile
26
+ if file.file.is_a? CarrierWave::SanitizedFile
28
27
  actor.create_content(file.file.to_file)
29
- when CarrierWave::Storage::Fog::File
30
- import_url(actor, file)
28
+ elsif file.url.present?
29
+ actor.import_url(file.url)
31
30
  else
32
- raise ArgumentError, "Unknown type of file #{file.class}"
31
+ raise ArgumentError, "#{file.class} received with #{file.file.class} object and no URL"
33
32
  end
34
33
  end
35
-
36
- # @param [Hyrax::Actors::FileSetActor] actor
37
- # @param [UploadedFileUploader] file
38
- def import_url(actor, file)
39
- actor.file_set.update(import_url: file.url)
40
- operation = Hyrax::Operation.create!(user: actor.user,
41
- operation_type: "Attach File")
42
- ImportUrlJob.perform_later(actor.file_set, operation)
43
- end
44
34
  end
@@ -1,3 +1,4 @@
1
+ require_dependency 'hyrax/name'
1
2
  module Hyrax
2
3
  module Naming
3
4
  extend ActiveSupport::Concern
@@ -5,16 +5,16 @@ module Hyrax
5
5
 
6
6
  belongs_to :permission_template
7
7
 
8
- def view?
9
- access == 'view'
10
- end
8
+ VIEW = 'view'.freeze
9
+ DEPOSIT = 'deposit'.freeze
10
+ MANAGE = 'manage'.freeze
11
11
 
12
- def deposit?
13
- access == 'deposit'
14
- end
15
-
16
- def manage?
17
- access == 'manage'
18
- end
12
+ enum(
13
+ access: {
14
+ VIEW => VIEW,
15
+ DEPOSIT => DEPOSIT,
16
+ MANAGE => MANAGE
17
+ }
18
+ )
19
19
  end
20
20
  end
@@ -54,5 +54,35 @@ module Sipity
54
54
  workflow.update!(active: true)
55
55
  end
56
56
  end
57
+
58
+ # Grant a workflow responsibility to a set of agents and remove it from any
59
+ # agents who currently have the workflow responsibility, but are not in the
60
+ # provided list
61
+ # @param [Sipity::Role] role the role to grant
62
+ # @param [Array<Sipity::Agent>] agents the agents to grant it to
63
+ def update_responsibilities(role:, agents:)
64
+ add_workflow_responsibilities(role, agents)
65
+ remove_workflow_responsibilities(role, agents)
66
+ end
67
+
68
+ private
69
+
70
+ # Give workflow responsibilites to the provided agents for the given role
71
+ # @param [Sipity::Role] role
72
+ # @param [Array<Sipity::Agent>] agents
73
+ def add_workflow_responsibilities(role, agents)
74
+ Hyrax::Workflow::PermissionGenerator.call(roles: role,
75
+ workflow: self,
76
+ agents: agents)
77
+ end
78
+
79
+ # Find any workflow_responsibilities held by agents not in the allowed_agents
80
+ # and remove them
81
+ # @param [Sipity::Role] role
82
+ # @param [Array<Sipity::Agent>] allowed_agents
83
+ def remove_workflow_responsibilities(role, allowed_agents)
84
+ wf_role = Sipity::WorkflowRole.find_by(workflow: self, role_id: role)
85
+ wf_role.workflow_responsibilities.where.not(agent: allowed_agents).destroy_all
86
+ end
57
87
  end
58
88
  end
@@ -1,44 +1,30 @@
1
1
  module Hyrax
2
2
  module Admin
3
+ # Displays a single workflow role
3
4
  class WorkflowRolePresenter
4
- def users
5
- ::User.registered
5
+ def initialize(workflow_role)
6
+ @workflow = workflow_role.workflow
7
+ @role = workflow_role.role
8
+ @admin_set_id = workflow.permission_template.admin_set_id
6
9
  end
7
10
 
8
- def presenter_for(user)
9
- agent = user.sipity_agent
10
- return unless agent
11
- AgentPresenter.new(agent)
11
+ # @todo This is a hack; I don't want to include reference to the admin set;
12
+ # However based on the current UI, in which we list all workflows (spanning all admin sets) this is required.
13
+ # @return [String] A meaningful label for the given WorkflowRole
14
+ def label
15
+ "#{admin_set_label(admin_set_id)} - #{role.name} (#{workflow.name})"
12
16
  end
13
17
 
14
- class AgentPresenter
15
- def initialize(agent)
16
- @agent = agent
17
- end
18
-
19
- def responsibilities_present?
20
- @agent.workflow_responsibilities.any?
21
- end
18
+ private
22
19
 
23
- def responsibilities
24
- @agent.workflow_responsibilities.each do |responsibility|
25
- yield ResponsibilityPresenter.new(responsibility)
26
- end
27
- end
28
- end
20
+ attr_accessor :workflow, :role, :admin_set_id
29
21
 
30
- class ResponsibilityPresenter
31
- def initialize(responsibility)
32
- @responsibility = responsibility
33
- @wf_role = responsibility.workflow_role
22
+ def admin_set_label(id)
23
+ result = ActiveFedora::Base.search_by_id(id, fl: 'title_tesim')
24
+ result['title_tesim'].first
25
+ rescue ActiveFedora::ObjectNotFoundError
26
+ "[AdminSet ID=#{id}]"
34
27
  end
35
-
36
- attr_accessor :responsibility
37
-
38
- def label
39
- "#{@wf_role.workflow.name} - #{@wf_role.role.name}"
40
- end
41
- end
42
28
  end
43
29
  end
44
30
  end
@@ -0,0 +1,43 @@
1
+ module Hyrax
2
+ module Admin
3
+ # Displays a list of users and their associated workflow roles
4
+ class WorkflowRolesPresenter
5
+ def users
6
+ ::User.registered
7
+ end
8
+
9
+ def presenter_for(user)
10
+ agent = user.sipity_agent
11
+ return unless agent
12
+ AgentPresenter.new(agent)
13
+ end
14
+
15
+ class AgentPresenter
16
+ def initialize(agent)
17
+ @agent = agent
18
+ end
19
+
20
+ def responsibilities_present?
21
+ @agent.workflow_responsibilities.any?
22
+ end
23
+
24
+ def responsibilities
25
+ @agent.workflow_responsibilities.each do |responsibility|
26
+ yield ResponsibilityPresenter.new(responsibility)
27
+ end
28
+ end
29
+ end
30
+
31
+ class ResponsibilityPresenter
32
+ def initialize(responsibility)
33
+ @responsibility = responsibility
34
+ @workflow_role_presenter = WorkflowRolePresenter.new(responsibility.workflow_role)
35
+ end
36
+
37
+ attr_accessor :responsibility
38
+
39
+ delegate :label, to: :@workflow_role_presenter
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,30 @@
1
+ module Hyrax
2
+ # Presents the options for the Collection widget on the create/edit form
3
+ class CollectionOptionsPresenter
4
+ # @param [Hyrax::CollectionsService] service
5
+ def initialize(service)
6
+ @service = service
7
+ end
8
+
9
+ # Return AdminSet selectbox options based on access type
10
+ # @param [Symbol] access :read or :edit
11
+ def select_options(access = :edit)
12
+ option_values = results(access).map do |solr_doc|
13
+ [solr_doc.to_s, solr_doc.id]
14
+ end
15
+ option_values.sort do |a, b|
16
+ if a.first && b.first
17
+ a.first <=> b.first
18
+ else
19
+ a.first ? -1 : 1
20
+ end
21
+ end
22
+ end
23
+
24
+ private
25
+
26
+ def results(access)
27
+ @service.search_results(access)
28
+ end
29
+ end
30
+ end
@@ -11,9 +11,9 @@ module Hyrax
11
11
  sipity_entity.workflow_state_name if sipity_entity
12
12
  end
13
13
 
14
- # TODO: maybe i18n here?
15
14
  def state_label
16
- state
15
+ return unless state
16
+ I18n.t("hyrax.workflow.state.#{state}", default: state.humanize)
17
17
  end
18
18
 
19
19
  # Returns an array of tuples (key, label) appropriate for a radio group
@@ -0,0 +1,13 @@
1
+ module Hyrax
2
+ # Finds a list of works. It returns no result if you don't have
3
+ # access to the requested work. If the work is suppressed (due to being in a
4
+ # workflow), then it checks to see if the current_user has any workflow role
5
+ # on the given work.
6
+ class ActiveWorksSearchBuilder < Hyrax::SearchBuilder
7
+ include Hyrax::FilterByType
8
+
9
+ def only_works?
10
+ true
11
+ end
12
+ end
13
+ end
@@ -1,15 +1,12 @@
1
- # Added to allow for the My controller to show only things I have edit access to
2
- class Hyrax::MyWorksSearchBuilder < Hyrax::SearchBuilder
3
- include Hyrax::FilterByType
1
+ module Hyrax
2
+ # Added to allow for the Hyrax::My::WorksController to show only things I have deposited
3
+ # If the work went through mediated deposit, I may no longer have edit access to it.
4
+ class MyWorksSearchBuilder < ActiveWorksSearchBuilder
5
+ self.default_processor_chain += [:show_only_resources_deposited_by_current_user]
4
6
 
5
- self.default_processor_chain += [:show_only_resources_deposited_by_current_user]
6
-
7
- # We remove the access controls filter, because some of the works a user has
8
- # deposited may have gone through a workflow which has removed their ability
9
- # to edit the work.
10
- self.default_processor_chain -= [:add_access_controls_to_solr_params]
11
-
12
- def only_works?
13
- true
7
+ # We remove the access controls filter, because some of the works a user has
8
+ # deposited may have gone through a workflow which has removed their ability
9
+ # to edit the work.
10
+ self.default_processor_chain -= [:add_access_controls_to_solr_params]
14
11
  end
15
12
  end
@@ -0,0 +1,7 @@
1
+ module Hyrax
2
+ # Returns all works, either active or suppressed.
3
+ # This should only be used by an admin user
4
+ class WorksSearchBuilder < ActiveWorksSearchBuilder
5
+ self.default_processor_chain -= [:only_active_works]
6
+ end
7
+ end
@@ -26,7 +26,7 @@ module Hyrax
26
26
  end
27
27
 
28
28
  def self.model_actor(curation_concern)
29
- actor_identifier = curation_concern.class.to_s.split('::').last
29
+ actor_identifier = curation_concern.class.to_s
30
30
  "Hyrax::Actors::#{actor_identifier}Actor".constantize
31
31
  end
32
32
  end
@@ -58,8 +58,11 @@ module Hyrax
58
58
  admin_set.creator = [creating_user.user_key] if creating_user
59
59
  admin_set.save.tap do |result|
60
60
  if result
61
- permission_template = create_permission_template
62
- create_workflows_for(permission_template: permission_template)
61
+ ActiveRecord::Base.transaction do
62
+ permission_template = create_permission_template
63
+ workflow = create_workflows_for(permission_template: permission_template)
64
+ create_default_access_for(permission_template: permission_template, workflow: workflow) if admin_set.default_set?
65
+ end
63
66
  end
64
67
  end
65
68
  end
@@ -77,9 +80,28 @@ module Hyrax
77
80
 
78
81
  def create_workflows_for(permission_template:)
79
82
  workflow_importer.call(permission_template: permission_template)
83
+ grant_all_workflow_roles_to_creating_user!(permission_template: permission_template)
80
84
  Sipity::Workflow.activate!(permission_template: permission_template, workflow_name: Hyrax.config.default_active_workflow_name)
81
85
  end
82
86
 
87
+ def grant_all_workflow_roles_to_creating_user!(permission_template:)
88
+ # Default admin set has a nil creating_user; guard against that condition
89
+ return if creating_user.nil?
90
+ # Grant all workflow roles to the creating_user
91
+ permission_template.available_workflows.each do |workflow|
92
+ Sipity::Role.all.each do |role|
93
+ workflow.update_responsibilities(role: role, agents: creating_user.to_sipity_agent)
94
+ end
95
+ end
96
+ end
97
+
98
+ # Gives deposit access to all registered users
99
+ def create_default_access_for(permission_template:, workflow:)
100
+ permission_template.access_grants.create(agent_type: 'group', agent_id: 'registered', access: 'deposit')
101
+ deposit = Sipity::Role.find_by_name!('depositing')
102
+ workflow.update_responsibilities(role: deposit, agents: Hyrax::Group.new('registered'))
103
+ end
104
+
83
105
  def default_workflow_importer
84
106
  Hyrax::Workflow::WorkflowImporter.method(:load_workflow_for)
85
107
  end
@@ -0,0 +1,13 @@
1
+ module Hyrax
2
+ # Answers queries about the cardinality of each field on the form.
3
+ class FormMetadataService < HydraEditor::FieldMetadataService
4
+ # @param [Class] model_class the class of the object
5
+ # @param [Symbol] field the field we want to know about
6
+ # @return [Boolean] true if the passed in field is a multivalued field
7
+ def self.multiple?(model_class, field)
8
+ return true if ['ordered_member_ids', 'in_works_ids', 'member_of_collection_ids'].include? field.to_s
9
+ # Inquire at the model level
10
+ super
11
+ end
12
+ end
13
+ end
@@ -5,12 +5,12 @@ module Hyrax
5
5
  # This method conforms to the signature of the .call method on Hydra::Derivatives::PersistOutputFileService
6
6
  # * Persists the file within the DirectContainer specified by :container
7
7
  #
8
- # @param [#read] stream the data to be persisted
8
+ # @param [String] the data to be persisted
9
9
  # @param [Hash] directives directions which can be used to determine where to persist to.
10
10
  # @option directives [String] url URI for the parent object.
11
11
  # @option directives [String] container Name of the container association.
12
- def self.call(stream, directives)
13
- file = Hydra::Derivatives::IoDecorator.new(stream, new_mime_type(directives.fetch(:format)))
12
+ def self.call(string, directives)
13
+ file = Hydra::Derivatives::IoDecorator.new(string, new_mime_type(directives.fetch(:format)))
14
14
  o_name = determine_original_name(file)
15
15
  m_type = determine_mime_type(file)
16
16
  uri = URI(directives.fetch(:url))
@@ -19,7 +19,9 @@ module Hyrax
19
19
  end
20
20
 
21
21
  def call
22
- user.send_message(users_to_notify.uniq, message, subject)
22
+ users_to_notify.uniq.each do |recipient|
23
+ user.send_message(recipient, message, subject)
24
+ end
23
25
  end
24
26
 
25
27
  protected
@@ -1,6 +1,6 @@
1
1
  module Hyrax
2
2
  module Workflow
3
- class ActivateObject
3
+ module ActivateObject
4
4
  ##
5
5
  # This is a built in function for workflow, setting the `#state`
6
6
  # of the target to the Fedora 'active' status URI
@@ -7,7 +7,7 @@ module Hyrax
7
7
  # @param target [#state] an instance of a model that includes `Hyrax::Suppressible`
8
8
  #
9
9
  # @return [RDF::Vocabulary::Term] the Fedora Resource Status 'inactive' term
10
- class DeactivateObject
10
+ module DeactivateObject
11
11
  def self.call(target:, **)
12
12
  target.state = Vocab::FedoraResourceStatus.inactive
13
13
  end
@@ -2,7 +2,7 @@ module Hyrax
2
2
  module Workflow
3
3
  # This is a built in function for workflow, so that a workflow action can be created that
4
4
  # grants the creator the ability to alter it.
5
- class GrantEditToDepositor
5
+ module GrantEditToDepositor
6
6
  def self.call(target:, **)
7
7
  target.edit_users += [target.depositor]
8
8
  end
@@ -0,0 +1,13 @@
1
+ module Hyrax
2
+ module Workflow
3
+ # This is a built in function for workflow, so that a workflow action can be created that
4
+ # grants the creator the ability to view their work.
5
+ module GrantReadToDepositor
6
+ # @param [#read_users=, #read_users] target (likely an ActiveRecord::Base) to which we are adding read_users for the depositor
7
+ # @return void
8
+ def self.call(target:, **)
9
+ target.read_users += [target.depositor]
10
+ end
11
+ end
12
+ end
13
+ end