Sha256: 4e806a1d98dec9e409bce32b551e6359cf6f06204d0797de654659bd20ca1309

Contents?: true

Size: 783 Bytes

Versions: 22

Compression:

Stored size: 783 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
    # removes the creators the ability to alter it.
    module RevokeEditFromDepositor
      def self.call(target:, **)
        return true unless target.try(:depositor)

        model = target.try(:model) || target # get the model if target is a ChangeSet
        model.edit_users = model.edit_users.to_a - Array.wrap(target.depositor)
        model.try(:permission_manager)&.acl&.save

        # If there are a lot of members, revoking access from each could take a
        # long time. Do this work in the background.
        RevokeEditFromMembersJob.perform_later(model, target.depositor)
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
hyrax-5.1.0.pre.beta1 app/services/hyrax/workflow/revoke_edit_from_depositor.rb
hyrax-5.0.4 app/services/hyrax/workflow/revoke_edit_from_depositor.rb
hyrax-5.0.3 app/services/hyrax/workflow/revoke_edit_from_depositor.rb
hyrax-5.0.2 app/services/hyrax/workflow/revoke_edit_from_depositor.rb
hyrax-5.0.1 app/services/hyrax/workflow/revoke_edit_from_depositor.rb
hyrax-5.0.0 app/services/hyrax/workflow/revoke_edit_from_depositor.rb
hyrax-5.0.0.rc3 app/services/hyrax/workflow/revoke_edit_from_depositor.rb
hyrax-5.0.0.rc2 app/services/hyrax/workflow/revoke_edit_from_depositor.rb
hyrax-5.0.0.rc1 app/services/hyrax/workflow/revoke_edit_from_depositor.rb
hyrax-3.6.0 app/services/hyrax/workflow/revoke_edit_from_depositor.rb
hyrax-4.0.0 app/services/hyrax/workflow/revoke_edit_from_depositor.rb
hyrax-4.0.0.rc3 app/services/hyrax/workflow/revoke_edit_from_depositor.rb
hyrax-4.0.0.rc2 app/services/hyrax/workflow/revoke_edit_from_depositor.rb
hyrax-4.0.0.rc1 app/services/hyrax/workflow/revoke_edit_from_depositor.rb
hyrax-3.5.0 app/services/hyrax/workflow/revoke_edit_from_depositor.rb
hyrax-4.0.0.beta2 app/services/hyrax/workflow/revoke_edit_from_depositor.rb
hyrax-3.4.2 app/services/hyrax/workflow/revoke_edit_from_depositor.rb
hyrax-4.0.0.beta1 app/services/hyrax/workflow/revoke_edit_from_depositor.rb
hyrax-3.4.1 app/services/hyrax/workflow/revoke_edit_from_depositor.rb
hyrax-3.4.0 app/services/hyrax/workflow/revoke_edit_from_depositor.rb