From b82414dc53d2feba5fc0d7a8427cc16a0d321138 Mon Sep 17 00:00:00 2001 From: Ian Ballou Date: Fri, 13 Oct 2023 16:49:41 +0000 Subject: [PATCH] Fixes #36828 - add host products report jail methods --- .../concerns/base_template_scope_extensions.rb | 13 +++++++++++++ .../katello/concerns/host_managed_extensions.rb | 2 +- .../katello/concerns/organization_extensions.rb | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app/lib/katello/concerns/base_template_scope_extensions.rb b/app/lib/katello/concerns/base_template_scope_extensions.rb index 02398fb71fa..f4110ebf873 100644 --- a/app/lib/katello/concerns/base_template_scope_extensions.rb +++ b/app/lib/katello/concerns/base_template_scope_extensions.rb @@ -88,6 +88,19 @@ def host_products_names(host) end end + apipie :method, 'Returns installed product names for the host with CP IDs' do + required :host, 'Host::Managed', desc: 'Host object to get products for' + returns array_of: String, desc: 'Array with names and CP IDs of installed products on the host' + end + def host_products_names_and_ids(host) + products = host_products(host) + if products + products.collect { |product| "#{product.name} (#{product.cp_product_id})" } + else + [] + end + end + apipie :method, 'Returns the host collections the host belongs to' do required :host, 'Host::Managed', desc: 'Host object to get the host collections for' returns array_of: 'HostCollection', desc: "Array of the host collection objects the host belongs to" diff --git a/app/models/katello/concerns/host_managed_extensions.rb b/app/models/katello/concerns/host_managed_extensions.rb index 9e760cd2fed..34b6d953b0e 100644 --- a/app/models/katello/concerns/host_managed_extensions.rb +++ b/app/models/katello/concerns/host_managed_extensions.rb @@ -587,7 +587,7 @@ class ::Host::Managed::Jail < Safemode::Jail :host_collections, :pools, :hypervisor_host, :installed_debs, :installed_packages, :traces_helpers, :advisory_ids, :package_names_for_job_template, :filtered_entitlement_quantity_consumed, :bound_repositories, - :single_content_view, :single_lifecycle_environment + :single_content_view, :single_lifecycle_environment, :purpose_role_status_label, :purpose_usage_status_label end class ActiveRecord::Associations::CollectionProxy::Jail < Safemode::Jail diff --git a/app/models/katello/concerns/organization_extensions.rb b/app/models/katello/concerns/organization_extensions.rb index edb83be65c1..2a9022e1120 100644 --- a/app/models/katello/concerns/organization_extensions.rb +++ b/app/models/katello/concerns/organization_extensions.rb @@ -248,5 +248,5 @@ def audit_manifest_action(message) end class ::Organization::Jail < ::Safemode::Jail - allow :label + allow :label, :simple_content_access? end