From 8bc1b25da220b78de292b929d34915f5fbd064f8 Mon Sep 17 00:00:00 2001 From: Keenan Brock Date: Wed, 6 Jan 2021 23:45:28 -0500 Subject: [PATCH] hide ancestry from the api Ancestry is an encoded field with the parent id. This is only for internal consumption. If someone asks why this was removed, we can provide alternative options for discovering the ancestry. I had a customer say that this field was broken because it didn't contain something - but they weren't using the field correctly. That is why I went on this hidden attribute journey in the first place. I wanted to limit our exposure to customers using internal fields incorrectly. --- app/models/miq_ae_namespace.rb | 2 ++ app/models/orchestration_stack.rb | 1 + app/models/relationship.rb | 1 + app/models/service.rb | 1 + app/models/tenant.rb | 1 + 5 files changed, 6 insertions(+) diff --git a/app/models/miq_ae_namespace.rb b/app/models/miq_ae_namespace.rb index 726cba19291..2653a4f35eb 100644 --- a/app/models/miq_ae_namespace.rb +++ b/app/models/miq_ae_namespace.rb @@ -2,6 +2,8 @@ class MiqAeNamespace < ApplicationRecord has_ancestry + hide_attribute :ancestry + include MiqAeSetUserInfoMixin include MiqAeYamlImportExportMixin include RelativePathMixin diff --git a/app/models/orchestration_stack.rb b/app/models/orchestration_stack.rb index d510fcaca54..9f273f155aa 100644 --- a/app/models/orchestration_stack.rb +++ b/app/models/orchestration_stack.rb @@ -17,6 +17,7 @@ class OrchestrationStack < ApplicationRecord acts_as_miq_taggable has_ancestry + hide_attribute :ancestry belongs_to :ext_management_system, :foreign_key => :ems_id belongs_to :tenant diff --git a/app/models/relationship.rb b/app/models/relationship.rb index c4a1c9b9916..9a9c2d51207 100644 --- a/app/models/relationship.rb +++ b/app/models/relationship.rb @@ -2,6 +2,7 @@ class Relationship < ApplicationRecord has_ancestry + hide_attribute :ancestry belongs_to :resource, :polymorphic => true diff --git a/app/models/service.rb b/app/models/service.rb index 749a8ca5202..874545e87de 100644 --- a/app/models/service.rb +++ b/app/models/service.rb @@ -21,6 +21,7 @@ class Service < ApplicationRecord }.freeze has_ancestry :orphan_strategy => :destroy + hide_attribute :ancestry belongs_to :service_template # Template this service was cloned from belongs_to :tenant diff --git a/app/models/tenant.rb b/app/models/tenant.rb index 78c37e3ab33..e65e4a29f1b 100644 --- a/app/models/tenant.rb +++ b/app/models/tenant.rb @@ -20,6 +20,7 @@ class Tenant < ApplicationRecord before_destroy :ensure_can_be_destroyed has_ancestry(:orphan_strategy => :restrict) + hide_attribute :ancestry has_many :providers has_many :ext_management_systems