Sha256: 0d45c37732513f8ba4c63265b8c247aa21c955558e8dcecd2d62e38d6f972891

Contents?: true

Size: 799 Bytes

Versions: 5

Compression:

Stored size: 799 Bytes

Contents

module Kanaui
  class EngineController < ApplicationController

    layout :get_layout

    def get_layout
      layout ||= Kanaui.config[:layout]
    end

    def current_tenant_user
      # If the rails application on which that engine is mounted defines such method (Devise), we extract the current user,
      # if not we default to nil, and serve our static mock configuration
      user = current_user if respond_to?(:current_user)
      Kanaui.current_tenant_user.call(session, user)
    end

    def options_for_klient
      user = current_tenant_user
      {
          :username => user[:username],
          :password => user[:password],
          :session_id => user[:session_id],
          :api_key => user[:api_key],
          :api_secret => user[:api_secret]
      }
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
kanaui-2.0.0 app/controllers/kanaui/engine_controller.rb
kanaui-1.0.0 app/controllers/kanaui/engine_controller.rb
kanaui-0.6.1 app/controllers/kanaui/engine_controller.rb
kanaui-0.6.0 app/controllers/kanaui/engine_controller.rb
kanaui-0.5.1 app/controllers/kanaui/engine_controller.rb