From 37004bc2fd455dc922f2baf1b68fd6c70882d372 Mon Sep 17 00:00:00 2001 From: Joe Rafaniello Date: Thu, 24 Jul 2025 12:52:12 -0400 Subject: [PATCH] Extract the tenant id from the x_node Using params for the action rbac_tenant_delete is correct for this action. It should not be used for any role_allows? calls as they can be for doing different actions/product features. For example, after deleting a tenant, the subsequent call to replace the right cell and update the screen after the deletion should not refer to an already deleted tenant. Fixes #9512 --- app/controllers/ops_controller/ops_rbac.rb | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/app/controllers/ops_controller/ops_rbac.rb b/app/controllers/ops_controller/ops_rbac.rb index 21137282e5b..609b458b462 100644 --- a/app/controllers/ops_controller/ops_rbac.rb +++ b/app/controllers/ops_controller/ops_rbac.rb @@ -9,13 +9,8 @@ module OpsController::OpsRbac }.freeze def role_allows?(**options) - if MiqProductFeature.my_root_tenant_identifier?(options[:feature]) && params.key?(:id) && params[:id] != 'xx-tn' - if params[:id].to_s.include?('tn') - _, id, _ = TreeBuilder.extract_node_model_and_id(params[:id].to_s) - else - id = params[:id].to_s - end - + if MiqProductFeature.my_root_tenant_identifier?(options[:feature]) && self.x_node.to_s.start_with?("tn-") + _, id, _ = TreeBuilder.extract_node_model_and_id(self.x_node.to_s) options[:feature] = MiqProductFeature.tenant_identifier(options[:feature], id) end