Bug 1424842

Summary: Setting report menus via the API breaks report menus
Product: Red Hat CloudForms Management Engine Reporter: myoder
Component: APIAssignee: Tim Wade <twade>
Status: CLOSED ERRATA QA Contact: Niyaz Akhtar Ansari <nansari>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.6.0CC: jhardy, mfeifer, nansari, obarenbo, simaishi, tachoi
Target Milestone: GA   
Target Release: 5.9.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: report:api
Fixed In Version: 5.9.0.3 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-03-01 13:09:52 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: Bug
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Embargoed:
Bug Depends On: 1541324    
Bug Blocks:    

Description myoder 2017-02-19 19:15:29 UTC
Description of problem:

Using the API to set a report menu for a group puts invalid data in the database and results in all reports being displayed to the user.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. In the UI, set up custom report menu for a group. Say by removing folders.
2. Log in as a user in the group and verify the menu structure.
3. Pull down the JSON settings from the API. `curl -k -H "Accept: application/json" -u admin:smartvm  https://cfme-ui01/api/groups/<group_id>` > group_reports.json
4. Remove all values from the JSON except for the settings hash.
5. Send the data back to the server. ` curl -k -H "Content-Type: application/json" -H "Accept: application/json" -u admin:smartvm -X PUT -d @group_reports.json  https://cfme-ui01/api/groups/<group_id>`
6. Verify that the user's report menu is now invalid.

Actual results:


Expected results:


Additional info:
The root cause appears to be that the MiqGroup settings hash key is "reports_menu" (a string) when submitted via the API, but should be the symbol :reports_menu as is set when you edit via the UI.

You can recover from the issue by editing the group in the UI again or by manually setting the reports_menu array to a symbol key and deleting the string key via the Rails console.

Comment 3 Tim Wade 2017-10-06 18:51:45 UTC
PR: https://github.com/ManageIQ/manageiq/pull/16142

Comment 7 errata-xmlrpc 2018-03-01 13:09:52 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://access.redhat.com/errata/RHSA-2018:0380