Sha256: 17e526656d752c1b0c2dc43fea74643d64d360993e8d293dd64f8aa93a249256

Contents?: true

Size: 708 Bytes

Versions: 7

Compression:

Stored size: 708 Bytes

Contents

# frozen_string_literal: true
module Hyrax
  module Workflow
    # 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.
    module GrantReadToDepositor
      # @param [#read_users=, #read_users] target (likely an ActiveRecord::Base) to which we are adding read_users for the depositor
      # @return void
      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
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hyrax-3.1.0 app/services/hyrax/workflow/grant_read_to_depositor.rb
hyrax-3.0.2 app/services/hyrax/workflow/grant_read_to_depositor.rb
hyrax-3.0.1 app/services/hyrax/workflow/grant_read_to_depositor.rb
hyrax-3.0.0 app/services/hyrax/workflow/grant_read_to_depositor.rb
hyrax-3.0.0.pre.rc4 app/services/hyrax/workflow/grant_read_to_depositor.rb
hyrax-3.0.0.pre.rc3 app/services/hyrax/workflow/grant_read_to_depositor.rb
hyrax-3.0.0.pre.rc2 app/services/hyrax/workflow/grant_read_to_depositor.rb