2013-02-05 14:16:51 -05:00
|
|
|
class Admin::ImpersonateController < Admin::AdminController
|
|
|
|
|
|
|
|
def create
|
|
|
|
requires_parameters(:username_or_email)
|
|
|
|
|
2013-02-26 11:27:59 -05:00
|
|
|
user = User.find_by_username_or_email(params[:username_or_email]).first
|
|
|
|
|
2013-02-05 14:16:51 -05:00
|
|
|
raise Discourse::NotFound if user.blank?
|
|
|
|
|
|
|
|
guardian.ensure_can_impersonate!(user)
|
|
|
|
|
|
|
|
# Log on as the user
|
|
|
|
log_on_user(user)
|
|
|
|
|
|
|
|
render nothing: true
|
2013-02-07 10:45:24 -05:00
|
|
|
end
|
2013-02-05 14:16:51 -05:00
|
|
|
|
|
|
|
end
|