Bug 1730402

Summary: Error while changing Role in the drop down while adding new Group
Product: Red Hat CloudForms Management Engine Reporter: Hilda Stastna <hstastna>
Component: UI - OPSAssignee: Hilda Stastna <hstastna>
Status: CLOSED CURRENTRELEASE QA Contact: Sudhir Mallamprabhakara <smallamp>
Severity: medium Docs Contact: Red Hat CloudForms Documentation <cloudforms-docs>
Priority: medium    
Version: 5.11.0CC: bmidwood, hkataria, lavenel, mpovolny, mshriver, obarenbo, simaishi
Target Milestone: GA   
Target Release: 5.11.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.11.0.19 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-12-13 14:57:56 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:

Description Hilda Stastna 2019-07-16 15:29:49 UTC
Description of problem:
There is an error while changing Role in the drop down while adding new Group,
and it is possible to save a Group without any specified Role (but this looks like that just in UI, in fact, previously selected Role is saved).

Version-Release number of selected component (if applicable):
5.11, also 5.10

How reproducible:
100%

Steps to Reproduce:
1. Go to Configuration > Access Control > Groups
2. Choose Configuration > Add a new Group
3. Choose some Role from the drop down
4. Set a chosen role back to 'Choose a Role'

Actual results:
This may vary across different versions, this is in the latest 5.11:

[----] I, [2019-07-16T16:05:55.562608 #13248:2ada22a6e13c]  INFO -- : Started POST "/ops/rbac_group_field_changed/new?group_role=" for 127.0.0.1 at 2019-07-16 16:05:55 +0200
[----] I, [2019-07-16T16:05:55.599398 #13248:2ada22a6e13c]  INFO -- : Processing by OpsController#rbac_group_field_changed as JS
[----] I, [2019-07-16T16:05:55.599608 #13248:2ada22a6e13c]  INFO -- :   Parameters: {"group_role"=>"", "id"=>"new"}
[----] F, [2019-07-16T16:05:55.617677 #13248:2ada22a6e13c] FATAL -- : Error caught: [RuntimeError] Invalid group selected.
/home/hstastna/manageiq/manageiq-ui-classic/app/controllers/ops_controller/ops_rbac.rb:1074:in `rbac_group_get_form_vars'
/home/hstastna/manageiq/manageiq-ui-classic/app/controllers/ops_controller/ops_rbac.rb:753:in `rbac_field_changed'
/home/hstastna/manageiq/manageiq-ui-classic/app/controllers/ops_controller/ops_rbac.rb:221:in `rbac_group_field_changed'

Expected results:
No error and displaying flash message about missing the appropriate field (which should be required) and/or proper responding of Add button.

Additional info:
Not sure about the expected results or the solution, maybe removing <Choose a Role> from the drop down would fix this.
And it is possible to continue, to add another info and to save a group.
Also it is possible to save the group with <Choose a Role> in the drop down! The previously selected Role is saved (step 3), after checking the saved info of the group. Also response of Add button (enabled/disabled) is not consistent in the screen, while filling in the info, choosing/changing Role in the drop down.

Comment 3 Hilda Stastna 2019-08-02 14:02:38 UTC
Fixes https://github.com/ManageIQ/manageiq-ui-classic/pull/5933

Comment 4 CFME Bot 2019-08-07 16:06:11 UTC
New commit detected on ManageIQ/manageiq-ui-classic/master:

https://github.com/ManageIQ/manageiq-ui-classic/commit/fc0c980998208b742a9b1b3d73fc2594d7c7cac1
commit fc0c980998208b742a9b1b3d73fc2594d7c7cac1
Author:     Hilda Stastna <hstastna>
AuthorDate: Fri Aug  2 09:32:29 2019 -0400
Commit:     Hilda Stastna <hstastna>
CommitDate: Fri Aug  2 09:32:29 2019 -0400

    Disable <Choose a Role> option to prevent error while adding Group

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

 app/views/ops/_rbac_group_details.html.haml | 6 +-
 1 file changed, 4 insertions(+), 2 deletions(-)

Comment 5 CFME Bot 2019-08-07 22:37:45 UTC
New commit detected on ManageIQ/manageiq-ui-classic/ivanchuk:

https://github.com/ManageIQ/manageiq-ui-classic/commit/03edbba27814be6cb25f7d2e7aa2640c12d2b35a
commit 03edbba27814be6cb25f7d2e7aa2640c12d2b35a
Author:     Harpreet Kataria <hkataria>
AuthorDate: Wed Aug  7 12:04:19 2019 -0400
Commit:     Harpreet Kataria <hkataria>
CommitDate: Wed Aug  7 12:04:19 2019 -0400

    Merge pull request #5933 from hstastna/Error_changing_Role_adding_Group

    Disable <Choose a Role> option to prevent error while adding Group

    (cherry picked from commit 85385728dc262b35e33cd46d048aceac7756c017)

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

 app/views/ops/_rbac_group_details.html.haml | 6 +-
 spec/views/ops/_rbac_group_details.html.haml_spec.rb | 9 +
 2 files changed, 13 insertions(+), 2 deletions(-)

Comment 6 Antonin Pagac 2019-08-16 08:42:45 UTC
Verified with 5.11.0.19.