Sha256: a078fe6dece1c842553d999d8676b17c71eac93f0c727e002458880782841a27

Contents?: true

Size: 810 Bytes

Versions: 7

Compression:

Stored size: 810 Bytes

Contents

# frozen_string_literal: true

module KPM
  class EngineController < ApplicationController
    layout :get_layout

    def get_layout
      layout ||= KPM.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)
      KPM.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

7 entries across 7 versions & 1 rubygems

Version Path
killbill-kpm-ui-3.0.3 app/controllers/kpm/engine_controller.rb
killbill-kpm-ui-3.0.2 app/controllers/kpm/engine_controller.rb
killbill-kpm-ui-2.1.1 app/controllers/kpm/engine_controller.rb
killbill-kpm-ui-3.0.1 app/controllers/kpm/engine_controller.rb
killbill-kpm-ui-2.0.2 app/controllers/kpm/engine_controller.rb
killbill-kpm-ui-2.0.1 app/controllers/kpm/engine_controller.rb
killbill-kpm-ui-2.0.0 app/controllers/kpm/engine_controller.rb