Sha256: a86fd097088ada5aa0af5135f6aac3786e6a5b7f6754a027dba8c9153381c0de

Contents?: true

Size: 501 Bytes

Versions: 2

Compression:

Stored size: 501 Bytes

Contents

class SwitchUserController < ApplicationController

  before_filter :developer_modes_only

  def set_current_user
    if params[:user_id].blank?
      warden.logout(:user)
    else
      current_user = User.find(params[:user_id])
      warden.set_user(current_user, :scope => :user)
    end
    redirect_to(request.env["HTTP_REFERER"] ? :back : root_path)
  end

  private

  def developer_modes_only
    render :text => "Permission Denied", :status => 403 unless Rails.env == "development"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
switch_user-0.1.1 app/controllers/switch_user_controller.rb
switch_user-0.1.0 app/controllers/switch_user_controller.rb