From 659edd9cb6987c973118ac7cf5b70704c8762a26 Mon Sep 17 00:00:00 2001 From: Manisha15 Date: Mon, 27 Feb 2023 17:38:32 +0100 Subject: [PATCH] Fixes Host view permissions to search by puppetclass --- app/models/concerns/foreman_puppet/extensions/host.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/concerns/foreman_puppet/extensions/host.rb b/app/models/concerns/foreman_puppet/extensions/host.rb index bf2fc87c..f2adf5e5 100644 --- a/app/models/concerns/foreman_puppet/extensions/host.rb +++ b/app/models/concerns/foreman_puppet/extensions/host.rb @@ -30,7 +30,7 @@ def search_by_deprecated_class(key, operator, value) def search_by_puppetclass(_key, operator, value) conditions = sanitize_sql_for_conditions(["puppetclasses.name #{operator} ?", value_to_sql(operator, value)]) config_group_ids = ForemanPuppet::ConfigGroup.joins(:puppetclasses).where(conditions).pluck(:id) - host_ids = ::Host.authorized(:view_hosts, Host).joins(puppet: :puppetclasses).where(conditions).distinct.pluck(:id) + host_ids = ::Host.authorized(:view_hosts).joins(puppet: :puppetclasses).where(conditions).distinct.pluck(:id) host_ids += ForemanPuppet::HostConfigGroup .where(host_type: 'ForemanPuppet::HostPuppetFacet') .where(config_group_id: config_group_ids)