From 019a51421bbb26eb3327a1661bdd486d0db1180c Mon Sep 17 00:00:00 2001 From: Joe Rafaniello Date: Wed, 5 May 2021 12:54:28 -0400 Subject: [PATCH] Add missing feature_type to recently added product features These were added/edited in https://github.com/ManageIQ/manageiq/pull/21108 and https://github.com/ManageIQ/manageiq/pull/21076 All other MiqProductFeature has the feature_type field: irb(main):004:0> MiqProductFeature.where(:feature_type => nil).count (0.7ms) SELECT COUNT(*) FROM "miq_product_features" WHERE "miq_product_features"."feature_type" IS NULL => 2 Because this was missing, the sort_by in MiqProductFeature.sort_children was failing with the error below when you try to login as a non-admin user: ``` [----] F, [2021-05-05T12:03:59.696562 #8905:3fcc63630bcc] FATAL -- : Error caught: [ActionView::Template::Error] comparison of Array with Array failed /Users/joerafaniello/Code/manageiq/app/models/miq_product_feature.rb:145:in `sort_by' /Users/joerafaniello/Code/manageiq/app/models/miq_product_feature.rb:145:in `sort_children' /Users/joerafaniello/Code/manageiq/app/models/miq_product_feature.rb:76:in `feature_children' /Users/joerafaniello/Code/manageiq/app/models/miq_user_role.rb:55:in `block in allows_any?' /Users/joerafaniello/Code/manageiq/app/models/miq_user_role.rb:55:in `map' /Users/joerafaniello/Code/manageiq/app/models/miq_user_role.rb:55:in `allows_any?' /Users/joerafaniello/Code/manageiq/app/models/miq_user_role.rb:57:in `allows_any?' /Users/joerafaniello/Code/manageiq/lib/rbac/authorizer.rb:62:in `user_role_allows_any?' /Users/joerafaniello/Code/manageiq/lib/rbac/authorizer.rb:28:in `role_allows?' /Users/joerafaniello/Code/manageiq/lib/rbac/authorizer.rb:6:in `role_allows?' /Users/joerafaniello/Code/manageiq/lib/rbac.rb:29:in `role_allows?' /Users/joerafaniello/Code/manageiq/app/models/user.rb:212:in `role_allows_any?' /Users/joerafaniello/Code/manageiq-ui-classic/app/presenters/menu/section.rb:38:in `visible?' ``` Admin users bypass some of the feature checks so was able to login without issue. --- db/fixtures/miq_product_features.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/db/fixtures/miq_product_features.yml b/db/fixtures/miq_product_features.yml index fc0b98361b8..4c14242f9d1 100644 --- a/db/fixtures/miq_product_features.yml +++ b/db/fixtures/miq_product_features.yml @@ -5084,6 +5084,7 @@ :children: - :name: List :description: Display Lists of Providers + :feature_type: view :identifier: ems_automation_manager_show_list - :name: Show :description: Display Individual Providers @@ -5139,6 +5140,7 @@ :children: - :name: List :description: Display Lists of Configured Systems + :feature_type: view :identifier: automation_manager_configured_system_show_list - :name: Show :description: Display Individual Configured Systems