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.12.0.rc2 app/cms/scrivito/workspace_selection_middleware.rb
scrivito_sdk-1.12.0.rc1 app/cms/scrivito/workspace_selection_middleware.rb
scrivito_sdk-1.11.0 app/cms/scrivito/workspace_selection_middleware.rb
scrivito_sdk-1.11.0.rc1 app/cms/scrivito/workspace_selection_middleware.rb
scrivito_sdk-1.10.0 app/cms/scrivito/workspace_selection_middleware.rb
scrivito_sdk-1.10.0.rc5 app/cms/scrivito/workspace_selection_middleware.rb
scrivito_sdk-1.10.0.rc4 app/cms/scrivito/workspace_selection_middleware.rb
scrivito_sdk-1.10.0.rc3 app/cms/scrivito/workspace_selection_middleware.rb
scrivito_sdk-1.10.0.rc2 lib/scrivito/workspace_selection_middleware.rb
scrivito_sdk-1.10.0.rc1 lib/scrivito/workspace_selection_middleware.rb
scrivito_sdk-1.9.1 lib/scrivito/workspace_selection_middleware.rb
scrivito_sdk-1.9.1.rc1 lib/scrivito/workspace_selection_middleware.rb
scrivito_sdk-1.9.0 lib/scrivito/workspace_selection_middleware.rb
scrivito_sdk-1.9.0.rc2 lib/scrivito/workspace_selection_middleware.rb
scrivito_sdk-1.9.0.rc1 lib/scrivito/workspace_selection_middleware.rb
scrivito_sdk-1.8.1 lib/scrivito/workspace_selection_middleware.rb
scrivito_sdk-1.8.1.rc1 lib/scrivito/workspace_selection_middleware.rb
scrivito_sdk-1.8.0 lib/scrivito/workspace_selection_middleware.rb
scrivito_sdk-1.8.0.rc2 lib/scrivito/workspace_selection_middleware.rb
scrivito_sdk-1.8.0.rc1 lib/scrivito/workspace_selection_middleware.rb