Skip to content

Commit

Permalink
Fixes Host view permissions to search by puppetclass
Browse files Browse the repository at this point in the history
  • Loading branch information
Manisha15 committed Feb 28, 2023
1 parent 6a05571 commit 659edd9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/concerns/foreman_puppet/extensions/host.rb
Expand Up @@ -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)
Expand Down

0 comments on commit 659edd9

Please sign in to comment.