2024-01-20 23:53:14 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
|
|
class TestingAccountsController < ApplicationController
|
|
|
|
|
skip_authorization_check only: :destroy
|
|
|
|
|
|
2026-04-27 12:13:53 +03:00
|
|
|
def create
|
2024-01-20 23:53:14 +02:00
|
|
|
authorize!(:manage, current_account)
|
|
|
|
|
authorize!(:manage, current_user)
|
|
|
|
|
|
2024-02-03 22:37:17 +02:00
|
|
|
impersonate_user(Accounts.find_or_create_testing_user(true_user.account))
|
2024-01-20 23:53:14 +02:00
|
|
|
|
|
|
|
|
redirect_back(fallback_location: root_path)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
|
stop_impersonating_user
|
|
|
|
|
|
|
|
|
|
redirect_back(fallback_location: root_path)
|
|
|
|
|
end
|
|
|
|
|
end
|