diff --git a/app/controllers/api/reports_controller.rb b/app/controllers/api/reports_controller.rb index d359d68a7c..eef156586b 100644 --- a/app/controllers/api/reports_controller.rb +++ b/app/controllers/api/reports_controller.rb @@ -17,7 +17,7 @@ def find_reports(id) def run_resource(type, id, _data) report = resource_search(id, type, MiqReport) - report_result = MiqReportResult.find(report.queue_generate_table) + report_result = MiqReportResult.find(report.queue_generate_table(:userid => User.current_user.userid)) run_report_result(true, "running report #{report.id}", :task_id => report_result.miq_task_id, diff --git a/spec/requests/reports_spec.rb b/spec/requests/reports_spec.rb index b1890e20b1..4c61c896e4 100644 --- a/spec/requests/reports_spec.rb +++ b/spec/requests/reports_spec.rb @@ -215,6 +215,8 @@ :success => true, :message => "running report #{report.id}" ) + actual = MiqReportResult.find(ApplicationRecord.uncompress_id(response.parsed_body["result_id"])) + expect(actual.userid).to eq("api_user_id") end it "can schedule a run" do