Module: Hyrax::Workflow::GrantReadToDepositor

Defined in:
app/services/hyrax/workflow/grant_read_to_depositor.rb

Overview

This is a built in function for workflow, so that a workflow action can be created that grants the creator the ability to view their work.

Class Method Summary collapse

Class Method Details

.call(target:) ⇒ Object

Returns void.

Parameters:

  • target (#read_users=, #read_users)

    (likely an ActiveRecord::Base) to which we are adding read_users for the depositor

Returns:

  • void



8
9
10
11
12
13
# File 'app/services/hyrax/workflow/grant_read_to_depositor.rb', line 8

def self.call(target:, **)
  target.read_users += [target.depositor]
  # If there are a lot of members, granting access to each could take a
  # long time. Do this work in the background.
  GrantReadToMembersJob.perform_later(target, target.depositor)
end