Bug 1289688

Summary: Scheduled reports generate for last group selected by user when user is a member of multiple groups
Product: Red Hat CloudForms Management Engine Reporter: Chris Pelland <cpelland>
Component: ReportingAssignee: Libor Pichler <lpichler>
Status: CLOSED ERRATA QA Contact: Aziza Karol <akarol>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 5.4.0CC: cpelland, dajohnso, gtanzill, jhardy, jprause, lpichler, mfeifer, obarenbo
Target Milestone: GAKeywords: ZStream
Target Release: 5.4.5   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.4.5.2 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1289676 Environment:
Last Closed: 2016-03-29 14:15:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1289676    
Bug Blocks: 1289687    

Comment 2 CFME Bot 2015-12-09 19:23:17 UTC
New commit detected on cfme/5.4.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=d559a7dafbfc5cadc17fe7e6bfd62069e614e847

commit d559a7dafbfc5cadc17fe7e6bfd62069e614e847
Author:     Libor Pichler <lpichler>
AuthorDate: Wed Dec 9 14:48:38 2015 +0100
Commit:     Libor Pichler <lpichler>
CommitDate: Wed Dec 9 14:48:38 2015 +0100

    Save the current group id of the user when creating schedule record
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1289688

 vmdb/app/controllers/report_controller/schedules.rb | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

Comment 3 CFME Bot 2015-12-09 19:23:21 UTC
New commit detected on cfme/5.4.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=3f43860c4f47c6b18e024dc45a1efded95ad3af2

commit 3f43860c4f47c6b18e024dc45a1efded95ad3af2
Author:     Libor Pichler <lpichler>
AuthorDate: Wed Dec 9 14:50:48 2015 +0100
Commit:     Libor Pichler <lpichler>
CommitDate: Wed Dec 9 16:24:15 2015 +0100

    Store current miq_group_id at time when was scheduled into MiqReportResult
    
    It avoids situation when user changes group between scheduling report and
    generating
    https://bugzilla.redhat.com/show_bug.cgi?id=1289688

 vmdb/app/models/miq_report/generator.rb | 3 ++-
 vmdb/app/models/miq_report_result.rb    | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

Comment 4 CFME Bot 2015-12-09 19:23:25 UTC
New commit detected on cfme/5.4.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=e6aa73b7e3ba114ff4a31f4bd3d6350d0853666c

commit e6aa73b7e3ba114ff4a31f4bd3d6350d0853666c
Merge: 4f5d33f d1cb336
Author:     Gregg Tanzillo <gtanzill>
AuthorDate: Wed Dec 9 14:20:17 2015 -0500
Commit:     Gregg Tanzillo <gtanzill>
CommitDate: Wed Dec 9 14:20:17 2015 -0500

    Merge branch 'bz_1289688' into '5.4.z'
    
    Save the current group id of the user when creating schedule record
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1289688
    https://trello.com/c/B7jTan2r
    https://github.com/ManageIQ/manageiq/pull/5681
    
    cherry-pick was not clean because of different structure directories than in upstream, but
    changed parts of code are same as it is in upstream, one exception is accessing to current user and current group, in this version is is thru ```session[:userid]``` and ```session[:group]``` (according this - spec are updated as well)
    
    See merge request !599

 .../app/controllers/report_controller/schedules.rb | 15 +++++---
 vmdb/app/models/miq_report/generator.rb            |  3 +-
 vmdb/app/models/miq_report_result.rb               |  2 +-
 vmdb/spec/controllers/report_controller_spec.rb    | 38 +++++++++++++++++++-
 .../miq_report_result/miq_report_result_spec.rb    | 42 ++++++++++++++++++++++
 5 files changed, 92 insertions(+), 8 deletions(-)

Comment 6 Aziza Karol 2016-02-12 11:28:10 UTC
Good to go.

Verified in 5.4.5.0.20160120124945_d8bf7e3 

steps:
1.configure ldap
2.login with the user which is member of multiple groups(say group1 and group2)
3.create a new schedule and schedule a report for user(group1 as current group) 
4.change the current group to group2
5.when report is generated original group should be displayed ie group1.

Comment 8 errata-xmlrpc 2016-03-29 14:15:21 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-0171.html