Sha256: 74ae2f4290ab133bf72a23a73136ee01ffa3103ca1b78eaacfe9cc9baf0f56cd
Contents?: true
Size: 964 Bytes
Versions: 29
Compression:
Stored size: 964 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_to user_path(previous_user_id) end end end end
Version data entries
29 entries across 29 versions & 1 rubygems