Bug 1339382

Summary: Service : RBAC : Assigning multiple tags from same category shows error when user tries to access catalog Item
Product: Red Hat CloudForms Management Engine Reporter: Shveta <sshveta>
Component: ApplianceAssignee: Šimon Lukašík <slukasik>
Status: CLOSED ERRATA QA Contact: Shveta <sshveta>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.5.0CC: abellott, cpelland, gtanzill, hkataria, jhardy, jprause, mpovolny, obarenbo, slukasik, sshveta
Target Milestone: GAKeywords: ZStream
Target Release: 5.5.5   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: service:rbac
Fixed In Version: 5.5.5.2 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-26 15:34:49 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:
Attachments:
Description Flags
multiple departments none

Description Shveta 2016-05-24 20:44:55 UTC
Created attachment 1161207 [details]
multiple departments

Description of problem:


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


How reproducible:


Steps to Reproduce:
1. Create a user , assign it to a group .Assign filters.
2. From same tag category Like department assign two tags Ex: Automotive and Accounting. 
3. Create a catalog item as admin 
4. Login as above user and try to access catalog item .
See Error .

Actual results:


Expected results:


Additional info:
Build : 5.5.4.2.20160517154712_629f93b 

Logs 
======================
[----] I, [2016-05-24T16:40:57.785962 #3051:fa198c]  INFO -- : Started GET "/catalog/explorer" for 127.0.0.1 at 2016-05-24 16:40:57 -0400
[----] I, [2016-05-24T16:40:57.787603 #3051:fa198c]  INFO -- : Processing by CatalogController#explorer as HTML
[----] F, [2016-05-24T16:40:57.857861 #3051:fa198c] FATAL -- : Error caught: [NoMethodError] undefined method `delete_if' for #<ServiceTemplate::ActiveRecord_Relation:0x00000010066228>
/opt/rh/cfme-gemset/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:136:in `method_missing'
/opt/rh/cfme-gemset/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:99:in `method_missing'
/var/www/miq/vmdb/lib/extensions/ar_taggable.rb:77:in `block in find_tags_by_grouping'
/var/www/miq/vmdb/lib/extensions/ar_taggable.rb:70:in `each'
/var/www/miq/vmdb/lib/extensions/ar_taggable.rb:70:in `find_tags_by_grouping'
/var/www/miq/vmdb/app/models/rbac.rb:240:in `get_managed_filter_object_ids'
/var/www/miq/vmdb/app/models/rbac.rb:246:in `find_targets_with_direct_rbac'
/var/www/miq/vmdb/app/models/rbac.rb:288:in `find_targets_with_rbac'
/var/www/miq/vmdb/app/models/rbac.rb:449:in `search'
/var/www/miq/vmdb/app/models/rbac.rb:322:in `filtered'
/var/www/miq/vmdb/app/presenters/tree_builder.rb:433:in `rbac_filtered_objects'
/var/www/miq/vmdb/app/presenters/tree_builder.rb:415:in `rbac_filtered_objects'
/var/www/miq/vmdb/app/presenters/tree_builder_service_catalog.rb:21:in `block in x_get_tree_roots'
/var/www/miq/vmdb/app/presenters/tree_builder_service_catalog.rb:20:in `each'
/var/www/miq/vmdb/app/presenters/tree_builder_service_catalog.rb:20:in `x_get_tree_roots'
/var/www/miq/vmdb/app/presenters/tree_builder.rb:284:in `x_get_tree_objects'
/var/www/miq/vmdb/app/presenters/tree_builder.rb:250:in `x_build_dynatree'
/var/www/miq/vmdb/app/presenters/tree_builder.rb:190:in `build_tree'
/var/www/miq/vmdb/app/presenters/tree_builder.rb:118:in `initialize'
/var/www/miq/vmdb/app/controllers/catalog_controller.rb:1973:in `new'
/var/www/miq/vmdb/app/controllers/catalog_controller.rb:1973:in `build_svccat_tree'
/var/www/miq/vmdb/app/controllers/catalog_controller.rb:219:in `explorer'
/opt/rh/cfme-gemset/gems/actionpack-4.2.6/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
/opt/rh/cfme-gemset/gems/actionpack-4.2.6/lib/abstract_controller/base.rb:198:in `process_action'
/opt/rh/cfme-gemset/gems/actionpack-4.2.6/lib/action_controller/metal/rendering.rb:10:in `process_action'
/opt/rh/cfme-gemset/gems/actionpack-4.2.6/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
/opt/rh/cfme-gemset/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:117:in `call'
/opt/rh/cfme-gemset/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:117:in `call'
/opt/rh/cfme-gemset/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
/opt/rh/cfme-gemset/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:505:in `call'
/opt/rh/cfme-gemset/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:505:in `call'
/opt/rh/cfme-gemset/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
/opt/rh/cfme-gemset/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks'
/opt/rh/cfme-gemset/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:81:in `run_callbacks'
/opt/rh/cfme-gemset/gems/actionpack-4.2.6/lib/abstract_controller/callbacks.rb:19:in `process_action'
/opt/rh/cfme-gemset/gems/actionpack-4.2.6/lib/action_controller/metal/rescue.rb:29:in `process_action'
/opt/rh/cfme-gemset/gems/actionpack-4.2.6/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
/opt/rh/cfme-gemset/gems/activesupport-4.2.6/lib/active_support/notifications.rb:164:in `block in instrument'
/opt/rh/cfme-gemset/gems/activesupport-4.2.6/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/opt/rh/cfme-gemset/gems/activesupport-4.2.6/lib/active_support/notifications.rb:164:in `instrument'
/opt/rh/cfme-gemset/gems/actionpack-4.2.6/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
/opt/rh/cfme-gemset/gems/actionpack-4.2.6/lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
/opt/rh/cfme-gemset/gems/activerecord-4.2.6/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
/opt/rh/cfme-gemset/gems/actionpack-4.2.6/lib/abstract_controller/base.rb:137:in `process'
/opt/rh/cfme-gemset/gems/actionview-4.2.6/lib/action_view/rendering.rb:30:in `process'
/opt/rh/cfme-gemset/gems/actionpack-4.2.6/lib/action_controller/metal.rb:196:in `dispatch'
/opt/rh/cfme-gemset/gems/actionpack-4.2.6/lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
/opt/rh/cfme-gemset/gems/actionpack-4.2.6/lib/action_controller/metal.rb:237:in `block in action'
/opt/rh/cfme-gemset/gems/actionpack-4.2.6/lib/action_dispatch/routing/route_set.rb:74:in `call'
/opt/rh/cfme-gemset/gems/actionpack-4.2.6/lib/action_dispatch/routing/route_set.rb:74:in `dispatch'
/opt/rh/cfme-gemset/gems/actionpack-4.2.6/lib/action_dispatch/routing/route_set.rb:43:in `serve'
/opt/rh/cfme-gemset/gems/actionpack-4.2.6/lib/action_dispatch/journey/router.rb:43:in `block in serve'
/opt/rh/cfme-gemset/gems/actionpack-4.2.6/lib/action_dispatch/journey/router.rb:30:in `each'
/opt/rh/cfme-gemset/gems/actionpack-4.2.6/lib/action_dispatch/journey/router.rb:30:in `serve'
/opt/rh/cfme-gemset/gems/actionpack-4.2.6/lib/action_dispatch/routing/route_set.rb:817:in `call'
/opt/rh/cfme-gemset/gems/rack-1.6.4/lib/rack/etag.rb:24:in `call'
/opt/rh/cfme-gemset/gems/rack-1.6.4/lib/rack/conditionalget.rb:25:in `call'
/opt/rh/cfme-gemset/gems/rack-1.6.4/lib/rack/head.rb:13:in `call'
/opt/rh/cfme-gemset/gems/actionpack-4.2.6/lib/action_dispatch/middleware/params_parser.rb:27:in `call'
/opt/rh/cfme-gemset/gems/actionpack-4.2.6/lib/action_dispatch/middleware/flash.rb:260:in `call'
/opt/rh/cfme-gemset/gems/rack-1.6.4/lib/rack/session/abstract/id.rb:225:in `context'
/opt/rh/cfme-gemset/gems/rack-1.6.4/lib/rack/session/abstract/id.rb:220:in `call'
/opt/rh/cfme-gemset/gems/actionpack-4.2.6/lib/action_dispatch/middleware/cookies.rb:560:in `call'
/opt/rh/cfme-gemset/gems/activerecord-4.2.6/lib/active_record/query_cache.rb:36:in `call'
/opt/rh/cfme-gemset/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call'
/opt/rh/cfme-gemset/gems/actionpack-4.2.6/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
/opt/rh/cfme-gemset/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:88:in `__run_callbacks__'
/opt/rh/cfme-gemset/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:778:in `_run_call_callbacks'
/opt/rh/cfme-gemset/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:81:in `run_callbacks'
/opt/rh/cfme-gemset/gems/actionpack-4.2.6/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
/opt/rh/cfme-gemset/gems/actionpack-4.2.6/lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
/opt/rh/cfme-gemset/gems/actionpack-4.2.6/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
/opt/rh/cfme-gemset/gems/actionpack-4.2.6/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
/opt/rh/cfme-gemset/gems/railties-4.2.6/lib/rails/rack/logger.rb:38:in `call_app'
/opt/rh/cfme-gemset/gems/railties-4.2.6/lib/rails/rack/logger.rb:22:in `call'
/opt/rh/cfme-gemset/gems/actionpack-4.2.6/lib/action_dispatch/middleware/request_id.rb:21:in `call'
/opt/rh/cfme-gemset/gems/rack-1.6.4/lib/rack/methodoverride.rb:22:in `call'
/opt/rh/cfme-gemset/gems/rack-1.6.4/lib/rack/runtime.rb:18:in `call'
/opt/rh/cfme-gemset/gems/activesupport-4.2.6/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
/opt/rh/cfme-gemset/gems/rack-1.6.4/lib/rack/lock.rb:17:in `call'
/opt/rh/cfme-gemset/gems/actionpack-4.2.6/lib/action_dispatch/middleware/static.rb:120:in `call'
/opt/rh/cfme-gemset/gems/actionpack-4.2.6/lib/action_dispatch/middleware/static.rb:120:in `call'
/opt/rh/cfme-gemset/gems/rack-1.6.4/lib/rack/sendfile.rb:113:in `call'
/opt/rh/cfme-gemset/gems/railties-4.2.6/lib/rails/engine.rb:518:in `call'
/opt/rh/cfme-gemset/gems/railties-4.2.6/lib/rails/application.rb:165:in `call'
/opt/rh/cfme-gemset/gems/rack-1.6.4/lib/rack/content_length.rb:15:in `call'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/thin-1.6.3/lib/thin/connection.rb:86:in `block in pre_process'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/thin-1.6.3/lib/thin/connection.rb:84:in `catch'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/thin-1.6.3/lib/thin/connection.rb:84:in `pre_process'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/thin-1.6.3/lib/thin/connection.rb:53:in `process'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/thin-1.6.3/lib/thin/connection.rb:39:in `receive_data'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/eventmachine-1.0.7/lib/eventmachine.rb:187:in `run_machine'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/eventmachine-1.0.7/lib/eventmachine.rb:187:in `run'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/thin-1.6.3/lib/thin/backends/base.rb:73:in `start'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/thin-1.6.3/lib/thin/server.rb:162:in `start'
/opt/rh/cfme-gemset/gems/rack-1.6.4/lib/rack/handler/thin.rb:19:in `run'
/opt/rh/cfme-gemset/gems/rack-1.6.4/lib/rack/server.rb:286:in `start'
/opt/rh/cfme-gemset/gems/railties-4.2.6/lib/rails/commands/server.rb:80:in `start'
/opt/rh/cfme-gemset/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:80:in `block in server'
/opt/rh/cfme-gemset/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:75:in `tap'
/opt/rh/cfme-gemset/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:75:in `server'
/opt/rh/cfme-gemset/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
/opt/rh/cfme-gemset/gems/railties-4.2.6/lib/rails/commands.rb:17:in `<top (required)>'
/var/www/miq/vmdb/bin/rails:4:in `require'
/var/www/miq/vmdb/bin/rails:4:in `<main>'

Comment 2 Šimon Lukašík 2016-05-26 12:15:57 UTC
Not reproducible on upstream.

Most probably fixed by https://github.com/ManageIQ/manageiq/issues/6144

Comment 3 Šimon Lukašík 2016-05-26 12:51:59 UTC
Shveta, could you please help me reproduce this issue? I cannot get this error out of cfme-5.5.4.2-1.el7cf.

I have group with multiple departments. And I am trying various combinations of catalog items-tags & catalogs, but no luck. Do you have a reproducing appliance around by any chance?

Comment 4 Shveta 2016-05-26 15:54:04 UTC
You can see the issue at https://10.8.59.229.
Login with shveta/redhat

Comment 5 Šimon Lukašík 2016-05-27 18:43:37 UTC
Thanks!

So this seems to affect only 5.5.z and https://github.com/ManageIQ/manageiq/issues/6144 fixes the issue.

Comment 8 CFME Bot 2016-06-27 14:18:30 UTC
New commit detected on cfme/5.5.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=a3b2da9f09ad51727491e31d16031d916a435b4f

commit a3b2da9f09ad51727491e31d16031d916a435b4f
Author:     Hanna <arnikasky>
AuthorDate: Wed Jan 13 13:23:57 2016 +0300
Commit:     Šimon Lukašík <isimluk>
CommitDate: Wed Jun 1 09:29:23 2016 +0200

    Fix bug with "delete_if"
    
    Fix this bug [#6144](https://github.com/ManageIQ/manageiq/issues/6144)
    (cherry picked from commit 54056d3d3704f74b6ef031e7befc48cd394d140f)
    
    Fixes:
    https://bugzilla.redhat.com/show_bug.cgi?id=1339382

 lib/extensions/ar_taggable.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comment 9 CFME Bot 2016-06-27 14:18:35 UTC
New commit detected on cfme/5.5.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=1e34af16596dc68ccd0bc846a996b11570a6d8b0

commit 1e34af16596dc68ccd0bc846a996b11570a6d8b0
Merge: f848970 a3b2da9
Author:     Gregg Tanzillo <gtanzill>
AuthorDate: Mon Jun 27 10:14:49 2016 -0400
Commit:     Gregg Tanzillo <gtanzill>
CommitDate: Mon Jun 27 10:14:49 2016 -0400

    Merge branch 'rhbz#1339382' into '5.5.z'
    
    Service : RBAC : Assigning multiple tags from same category shows error when user tries to access catalog Item
    
    Fixes downstream
    https://bugzilla.redhat.com/show_bug.cgi?id=1339382
    
    And also upstream [#6144](https://github.com/ManageIQ/manageiq/issues/6144)
    
    (cherry picked from commit 54056d3d3704f74b6ef031e7befc48cd394d140f)
    
    
    
    See merge request !956

 lib/extensions/ar_taggable.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comment 11 Shveta 2016-07-06 21:51:07 UTC
Blocked by https://bugzilla.redhat.com/show_bug.cgi?id=1351716

Comment 12 Shveta 2016-07-15 18:41:54 UTC
Fixed .
Verified in 5.5.5.2.20160712144556_629f93b

Comment 14 errata-xmlrpc 2016-07-26 15:34:49 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-1488.html