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..293b2409066 100644 --- a/app/models/katello/concerns/host_managed_extensions.rb +++ b/app/models/katello/concerns/host_managed_extensions.rb @@ -108,6 +108,8 @@ def remote_execution_proxies(provider, *_rest) delegate :content_source_id, :single_content_view, :single_lifecycle_environment, :default_environment?, :single_content_view_environment?, :multi_content_view_environment?, :kickstart_repository_id, :bound_repositories, :installable_errata, :installable_rpms, to: :content_facet, allow_nil: true + delegate :release_version, :purpose_role, :purpose_usage, to: :subscription_facet, allow_nil: true + has_many :content_view_environment_content_facets, through: :content_facet, class_name: 'Katello::ContentViewEnvironmentContentFacet' has_many :content_view_environments, through: :content_view_environment_content_facets has_many :content_views, through: :content_view_environments @@ -587,7 +589,8 @@ 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, :purpose_usage, :release_version, + :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