From 98a473c7c76f85496acfb7c7e9a36a947f86afea Mon Sep 17 00:00:00 2001 From: Jesus Bermudez Velazquez Date: Wed, 4 Sep 2024 12:31:36 +0100 Subject: [PATCH] Check only extensions for SCC activations When checking the registry access if system is hybrid, the check with SCC for the state of its activations should be done only with non free extensions, as base product is not free This Fixes that scenario --- engines/registry/app/models/access_scope.rb | 2 +- engines/registry/spec/app/models/access_scope_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/registry/app/models/access_scope.rb b/engines/registry/app/models/access_scope.rb index 7e5c7b7ad..511dbbca5 100644 --- a/engines/registry/app/models/access_scope.rb +++ b/engines/registry/app/models/access_scope.rb @@ -87,7 +87,7 @@ def allowed_paths(system = nil) allowed_product_classes = (active_product_classes & access_policies_yml.keys) if system && system.hybrid? # if the system is hybrid => check if the non free product subscription is still valid for accessing images - allowed_non_free_product_classes = allowed_product_classes.map { |s| s unless Product.find_by(product_class: s).free? } + allowed_non_free_product_classes = allowed_product_classes.map { |s| s unless Product.find_by(product_class: s, product_type: 'extension').free? }.compact unless allowed_non_free_product_classes.empty? auth_header = { 'HTTP_AUTHORIZATION' => ActionController::HttpAuthentication::Basic.encode_credentials(system.login, system.password) diff --git a/engines/registry/spec/app/models/access_scope_spec.rb b/engines/registry/spec/app/models/access_scope_spec.rb index 9b0f6dff0..1448388e7 100644 --- a/engines/registry/spec/app/models/access_scope_spec.rb +++ b/engines/registry/spec/app/models/access_scope_spec.rb @@ -194,7 +194,7 @@ system end let(:product1) do - product = FactoryBot.create(:product, :with_mirrored_repositories) + product = FactoryBot.create(:product, :with_mirrored_repositories, :extension) product.repositories.where(enabled: false).update(mirroring_enabled: false) product.update(product_class: 'SLES15-SP4-LTSS-X86') product