Skip to content

Commit

Permalink
Added functionality: ability to keep group and user when importing re…
Browse files Browse the repository at this point in the history
…port.

There is 'Preserve owner' checkbox added on Import report page, UI PR: ManageIQ/manageiq-ui-classic#5060
This checkbox controls if report will be imported in the old way: unconditionally override user_id and miq_group_id fields of imported report,
OR in the new way: keep those fields untouched.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1638533
  • Loading branch information
yrudman committed Dec 20, 2018
1 parent 6fa158d commit 46519b7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/miq_report/import_export.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def import_from_hash(report, options = nil)
report[:db_options].deep_symbolize_keys! if report[:db_options]

user = options[:user] || User.find_by_userid(options[:userid])
report.merge!("miq_group_id" => user.current_group_id, "user_id" => user.id)
report.merge!("miq_group_id" => user.current_group_id, "user_id" => user.id) unless options[:preserve_owner]

report["name"] = report.delete("menu_name")
rep = MiqReport.find_by(:name => report["name"])
Expand Down

0 comments on commit 46519b7

Please sign in to comment.