Sha256: 3027ea91ad60468ed440e7a2715799917d98bbdda4b30f7478995cf7bd679546

Contents?: true

Size: 1.96 KB

Versions: 6

Compression:

Stored size: 1.96 KB

Contents

# frozen_string_literal: true
module Hyrax
  class DefaultMiddlewareStack
    # rubocop:disable Metrics/MethodLength
    def self.build_stack
      ActionDispatch::MiddlewareStack.new.tap do |middleware|
        # Ensure you are mutating the most recent version
        middleware.use Hyrax::Actors::OptimisticLockValidator

        # Attach files from a URI (for BrowseEverything)
        middleware.use Hyrax::Actors::CreateWithRemoteFilesActor

        # Attach files uploaded in the form to the UploadsController
        middleware.use Hyrax::Actors::CreateWithFilesActor

        # Add/remove the resource to/from a collection
        middleware.use Hyrax::Actors::CollectionsMembershipActor

        # Add/remove to parent work
        middleware.use Hyrax::Actors::AddToWorkActor

        # Add/remove children (works or file_sets)
        middleware.use Hyrax::Actors::AttachMembersActor

        # Set the order of the children (works or file_sets)
        middleware.use Hyrax::Actors::ApplyOrderActor

        # Sets the default admin set if they didn't supply one
        middleware.use Hyrax::Actors::DefaultAdminSetActor

        # Decode the private/public/institution on the form into permisisons on
        # the model
        middleware.use Hyrax::Actors::InterpretVisibilityActor

        # Copies default permissions from the PermissionTemplate to the work
        middleware.use Hyrax::Actors::ApplyPermissionTemplateActor

        # Remove attached FileSets when destroying a work
        middleware.use Hyrax::Actors::CleanupFileSetsActor

        # Destroys the trophies in the database when the work is destroyed
        middleware.use Hyrax::Actors::CleanupTrophiesActor

        # Destroys the feature tag in the database when the work is destroyed
        middleware.use Hyrax::Actors::FeaturedWorkActor

        # Persist the metadata changes on the resource
        middleware.use Hyrax::Actors::ModelActor
      end
    end
    # rubocop:enable Metrics/MethodLength
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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