Bug 1576129

Summary: Unexpected Error when accessing SERVICE -> REQUESTS (undefined method find_tags_by_grouping)
Product: Red Hat CloudForms Management Engine Reporter: Reartes Guillermo <greartes>
Component: ApplianceAssignee: Yuri Rudman <yrudman>
Status: CLOSED CURRENTRELEASE QA Contact: Shveta <sshveta>
Severity: medium Docs Contact:
Priority: high    
Version: 5.8.0CC: abellott, cpelland, dajohnso, fdewaley, hkataria, ikaur, jrafanie, juanrodr, lavenel, mpovolny, ngupta, obarenbo, simaishi, sshveta, yrudman
Target Milestone: GAKeywords: TestOnly, ZStream
Target Release: 5.10.0   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: 5.10.0.3 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1583710 1583711 (view as bug list) Environment:
Last Closed: 2019-02-11 13:58:58 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1583710, 1583711    
Attachments:
Description Flags
tenant, role, group, user
none
role details
none
group
none
unexpected error
none
production.log showing the error none

Description Reartes Guillermo 2018-05-08 22:33:49 UTC
Created attachment 1433453 [details]
tenant, role, group, user

Description of problem:

Unable to access SERVICE -> REQUESTS due to UNEXPECTED ERROR

undefined method `find_tags_by_grouping' for #<MiqRequest::ActiveRecord_Relation:0x0000000021a278a0> [miq_request/show_list]

I tired several roles and permission combination.
It even happens when the role is given "everything".

Version-Release number of selected component (if applicable):
CF 4.6 (CFME 5.9.2.4)

How reproducible:
always

Steps to Reproduce:
1. create tenant, role, group and user as in the screenshots
2. login as user
3. go to SERVICE -> REQUESTS -> UNKNOWN ERROR

Actual results:
cannot access SERVICE -> REQUESTS UI Section

Expected results:
access SERVICE -> REQUESTS UI Section

Additional info:
admin is not affected.

Comment 2 Reartes Guillermo 2018-05-08 22:34:21 UTC
Created attachment 1433454 [details]
role details

Comment 3 Reartes Guillermo 2018-05-08 22:34:41 UTC
Created attachment 1433455 [details]
group

Comment 4 Reartes Guillermo 2018-05-08 22:35:00 UTC
Created attachment 1433456 [details]
unexpected error

Comment 5 Reartes Guillermo 2018-05-08 22:36:06 UTC
Created attachment 1433457 [details]
production.log showing the error

Comment 7 Felix Dewaleyne 2018-05-10 15:59:12 UTC
this affects all pages where the request list is present. the only role that can see anything is EVM_SuperAdministrator

Comment 13 Yuri Rudman 2018-05-22 20:03:19 UTC
I can reproduce "undefined method `find_tags_by_grouping'.. " error

Comment 16 CFME Bot 2018-05-23 15:17:10 UTC
New commit detected on ManageIQ/manageiq/master:

https://github.com/ManageIQ/manageiq/commit/582d4abc12cf7c94aed6d4885a42d68a00c9d5cc
commit 582d4abc12cf7c94aed6d4885a42d68a00c9d5cc
Author:     Yuri Rudman <yrudman>
AuthorDate: Tue May 22 22:45:22 2018 -0400
Commit:     Yuri Rudman <yrudman>
CommitDate: Tue May 22 22:45:22 2018 -0400

    MiqRequest was added to RBAC in https://github.com/ManageIQ/manageiq/pull/17208 but did not include ActAsTaggable concern.
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1576129

 app/models/miq_request.rb | 2 +
 1 file changed, 2 insertions(+)

Comment 17 Shveta 2018-05-23 17:42:39 UTC
Dev was able to recreate

Comment 24 Joe Rafaniello 2018-06-29 14:36:18 UTC
Imaan, a user reported a problem with this bug fix in https://github.com/ManageIQ/manageiq/pull/17466#issuecomment-395747685.  I'm working on a complete fix for this issue.

Comment 25 CFME Bot 2018-06-29 16:51:51 UTC
New commit detected on ManageIQ/manageiq/master:

https://github.com/ManageIQ/manageiq/commit/f8c05532cf654cff8e39bded83c25af8fbec281c
commit f8c05532cf654cff8e39bded83c25af8fbec281c
Author:     Joe Rafaniello <jrafanie>
AuthorDate: Fri Jun 29 10:59:11 2018 -0400
Commit:     Joe Rafaniello <jrafanie>
CommitDate: Fri Jun 29 10:59:11 2018 -0400

    Remove Request taggable and prevent tag filtering

    MiqRequest was changed to allow ownership for self service and limited
    self-service users in ManageIQ #17208, BZ #1545395

    This caused a problem if you had tag filters assign to a user's group
    undefined method `find_tags_by_grouping'.  This was fixed in
    ManageIQ #17466, BZ #1576129, and shipped with:

    Fine: BZ #1583711
    Gaprindindashvili: BZ #1583710

    Unfortunately, this second fix to add taggable caused a new bug: users in
    groups having tag filters could not see their own requests.

    This commit changes MiqRequest to no longer be taggable, since it's not
    even taggable in the UI and instead, we add MiqRequest to a list of
    models that are RBAC'able but not taggable so we don't try to filter
    MiqRequest based on a user's group tag filters.

    Credit goes to github user LorkScorguar who reported this issue and
    provided lots of diagnostics to help us fix this properly.

    To test this, simply assign managed filters to a user's group, such as
    /managed/environments/production, create a request for that user and
    try to see that user's request.  They couldn't see it if they received
    the intermediate fix, #17466, or if they didn't receive that fix, they'd
    receive the `find_tags_by_grouping` error shown above.

    For gaprindashvili and fine:
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1596738

    For hammer:
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1576129

 app/models/miq_request.rb | 2 -
 lib/rbac/filterer.rb | 2 +-
 spec/lib/rbac/filterer_spec.rb | 41 +
 3 files changed, 42 insertions(+), 3 deletions(-)

Comment 27 Yuri Rudman 2018-07-18 11:56:11 UTC
Fix for this BZ ("undefined method 'find_tags_by_grouping...' ") introduced another bug: user can not see requests if users are in groups with managed tags.

This new issue was reported in https://bugzilla.redhat.com/show_bug.cgi?id=1596738 and fixed in https://github.com/ManageIQ/manageiq/pull/17656

Comment 28 Shveta 2018-07-18 19:11:06 UTC
Fixed in 5.10.0.3.20180705151325_ce4d2b5