Class: Ooor::Rack

Inherits:
Object
  • Object
show all
Includes:
RackBehaviour
Defined in:
lib/ooor/rack.rb

Defined Under Namespace

Modules: RackBehaviour

Constant Summary collapse

DEFAULT_OOOR_SESSION_CONFIG_MAPPER =
Proc.new do |env|
  Ooor.logger.debug "\n\nWARNING: using DEFAULT_OOOR_SESSION_CONFIG_MAPPER, you should probably define your own instead!
  You can define an Ooor::Rack.ooor_session_config_mapper block that will be evaled
  in the context of the rack middleware call after user is authenticated using Warden.
  Use it to map a Warden authentication to the OpenERP authentication you want.\n"""
  Ooor.default_config
end

Instance Method Summary collapse

Methods included from RackBehaviour

#get_ooor_session, #set_ooor!, #set_ooor_session!, #share_openerp_session!

Constructor Details

#initialize(app = nil) ⇒ Rack

Returns a new instance of Rack.



103
104
105
# File 'lib/ooor/rack.rb', line 103

def initialize(app=nil)
  @app=app
end

Instance Method Details

#call(env) ⇒ Object



107
108
109
110
111
# File 'lib/ooor/rack.rb', line 107

def call(env)
  set_ooor!(env)
  status, headers, body = @app.call(env)
  set_ooor_session!(env, status, headers, body)
end