Sha256: 0b9fd414756f86bede7cc4cb3c9d6556f7ca54e06b0572204127f9a98ef3632f
Contents?: true
Size: 970 Bytes
Versions: 2
Compression:
Stored size: 970 Bytes
Contents
module Workarea module Admin class InvalidImpersonation < StandardError; end class ImpersonationsController < Admin::ApplicationController include Storefront::CurrentCheckout required_permissions :people def create new_user = User.find(params[:user_id]) raise InvalidImpersonation if new_user.admin? impersonate_user(new_user) login = Login.new(new_user, Order.new) self.current_order = login.previous_order || Order.new flash[:success] = t( 'workarea.admin.users.flash_messages.started', email: new_user.email ) redirect_to storefront.users_account_path end def destroy previous_user_id = cookies.signed[:user_id] stop_impersonation self.current_order = nil flash[:success] = t('workarea.admin.users.flash_messages.stopped') redirect_back_or(user_path(previous_user_id)) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
workarea-admin-3.4.42 | app/controllers/workarea/admin/impersonations_controller.rb |
workarea-admin-3.4.41 | app/controllers/workarea/admin/impersonations_controller.rb |