Sha256: b77adae825c9aaf102af84f9ed105d4619cb5720a21c2336ff8dc87ffe064565

Contents?: true

Size: 508 Bytes

Versions: 64

Compression:

Stored size: 508 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

  private

  def session(env)
    env[Rack::Session::Abstract::ENV_SESSION_KEY]
  end
end

end # module Scrivito

Version data entries

64 entries across 64 versions & 1 rubygems

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