Sha256: fc98464cb70feefe9f7ccec695c9943fa79ed4d369b50800950e33a6edc69478

Contents?: true

Size: 421 Bytes

Versions: 43

Compression:

Stored size: 421 Bytes

Contents

module Scrivito

class WorkspaceSelectionMiddleware
  def initialize(app)
    @app = app
  end

  def call(env)
    Workspace.current = proc do
      editing_context = env[EditingContextMiddleware::ENVKEY]

      if editing_context.authenticated_editor?
        editing_context.visible_workspace
      else
        Workspace.published_with_fallback
      end
    end

    @app.call(env)
  end
end

end # module Scrivito

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
scrivito_sdk-1.7.0 lib/scrivito/workspace_selection_middleware.rb
scrivito_sdk-1.7.0.rc2 lib/scrivito/workspace_selection_middleware.rb
scrivito_sdk-1.7.0.rc1 lib/scrivito/workspace_selection_middleware.rb