Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve group and user when importing reports #18270

Merged

Conversation

yrudman
Copy link
Contributor

@yrudman yrudman commented Dec 5, 2018

Issue:
When importing report (usually by admin user), report's access (defined in user_id and miq_group_id fields of report) got overwritten by ids of user who executed import and this is preventing from clean backup/restore operations.

Solution:

  • Introduce Preserver owner? checkbox which would control how import will work: old way (override) or new way (preserve user_id and miq_group_id from imported report)
  • add extra attributes (userid and group_description) for report export. Those attributes needed for importing saved report in multi-region environment

Corresponding PR on UI: ManageIQ/manageiq-ui-classic#5060

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1638533

@miq-bot add-label bug

yrudman added a commit to yrudman/manageiq-ui-classic that referenced this pull request Dec 6, 2018
…ser_id and miq_group_id field of imported report with value for user who is doing import. After: owrk old way (ovverride) f Preserver Owner checkbox unchecked and do not override (keep original values) if this checkbox checked. After: owrk old way (ovverride) f Preserver Owner checkbox unchecked and do not override (keep original values) if this checkbox checked. Depends on ManageIQ/manageiq#18270

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1638533
@yrudman yrudman force-pushed the keep-group-and-user-when-importing-report branch 3 times, most recently from 75b8947 to 4acbee4 Compare December 7, 2018 15:14
@miq-bot miq-bot changed the title [WIP] Preserve group and user when importing reports Preserve group and user when importing reports Dec 7, 2018
@miq-bot miq-bot removed the wip label Dec 7, 2018
@miq-bot

This comment has been minimized.

yrudman added a commit to yrudman/manageiq-ui-classic that referenced this pull request Dec 17, 2018
…ser_id and miq_group_id field of imported report with value for user who is doing import. After: owrk old way (ovverride) f Preserver Owner checkbox unchecked and do not override (keep original values) if this checkbox checked. After: owrk old way (ovverride) f Preserver Owner checkbox unchecked and do not override (keep original values) if this checkbox checked. Depends on ManageIQ/manageiq#18270

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1638533
@yrudman yrudman force-pushed the keep-group-and-user-when-importing-report branch 5 times, most recently from 65c47e7 to 38db427 Compare December 21, 2018 22:05
@yrudman yrudman force-pushed the keep-group-and-user-when-importing-report branch 3 times, most recently from 23d5df3 to 337fa66 Compare January 9, 2019 18:25
app/models/miq_report.rb Outdated Show resolved Hide resolved
spec/models/miq_report/import_export_spec.rb Outdated Show resolved Hide resolved
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.

In order to support report import in mutilregion environment:
 added 'userid' and 'group_description' attributes to exported report
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1638533
… attributes which are not present in the MqReport model: 'userid' and 'group_description'.

We need those attributes to import saved report in mutiregion environment, BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1638533.
To make sure that MiqReport#update_attributes(saved_report_atributes) will not raise error, we need to implement stub for assignment method for those added attributes
@yrudman yrudman force-pushed the keep-group-and-user-when-importing-report branch from 337fa66 to b2615d6 Compare January 11, 2019 13:45
@miq-bot
Copy link
Member

miq-bot commented Jan 11, 2019

Checked commits yrudman/manageiq@dd5afbe~...b2615d6 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
4 files checked, 1 offense detected

app/models/miq_report/import_export.rb

@gtanzillo gtanzillo added this to the Sprint 103 Ending Jan 21, 2019 milestone Jan 15, 2019
@gtanzillo gtanzillo merged commit 620d833 into ManageIQ:master Jan 15, 2019
@yrudman yrudman deleted the keep-group-and-user-when-importing-report branch January 15, 2019 14:29
simaishi pushed a commit that referenced this pull request Mar 29, 2019
…ting-report

Preserve group and user when importing reports

(cherry picked from commit 620d833)

https://bugzilla.redhat.com/show_bug.cgi?id=1693719
@simaishi
Copy link
Contributor

Hammer backport details:

$ git log -1
commit 2b631adc8d385e593831983d6a8d982efe7d573c
Author: Gregg Tanzillo <gtanzill@redhat.com>
Date:   Tue Jan 15 09:27:44 2019 -0500

    Merge pull request #18270 from yrudman/keep-group-and-user-when-importing-report
    
    Preserve group and user when importing reports
    
    (cherry picked from commit 620d833a6ba2632c06cc8e9fda672a5796bcc2a7)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1693719

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants