Sha256: 2f66082208982018743f41c7b3b43e2264a8c02bd32f499695dc1c05de3b2421

Contents?: true

Size: 599 Bytes

Versions: 1

Compression:

Stored size: 599 Bytes

Contents

module SwitchUser
  module Provider
    class Devise < Base
      def initialize(controller)
        @controller = controller
        @warden = @controller.warden
      end

      def login(user, scope = :user)
        if SwitchUser.provider.is_a?(Hash) && SwitchUser.provider[:store_sign_in]
          @warden.set_user(user, scope: scope)
        else
          @warden.session_serializer.store(user, scope)
        end
      end

      def logout(scope = :user)
        @warden.logout(scope)
      end

      def current_user(scope = :user)
        @warden.user(scope)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
switch_user-1.4.0 lib/switch_user/provider/devise.rb