Class: Hyrax::DefaultMiddlewareStack

Inherits:
Object
  • Object
show all
Defined in:
app/services/hyrax/default_middleware_stack.rb

Class Method Summary collapse

Class Method Details

.build_stackObject

rubocop:disable Metrics/MethodLength



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'app/services/hyrax/default_middleware_stack.rb', line 4

def self.build_stack
  ActionDispatch::MiddlewareStack.new.tap do |middleware|
    # Used to wrap everything in a database transaction, if the save of the resource
    # failed then rolled back any database AdminSetChangeSet
    # This was problematic, is removed in v3.0, and is currently a no-op
    # Backport of https://github.com/samvera/hyrax/pull/3482
    middleware.use Hyrax::Actors::TransactionalRequest

    # 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

    # Handles transfering ownership of works from one user to another
    middleware.use Hyrax::Actors::TransferRequestActor

    # 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

    # Start the workflow for this work
    middleware.use Hyrax::Actors::InitializeWorkflowActor
  end
end