Skip to content

Commit

Permalink
feat(APIv2): RHINENG-11782 expose security_guide version in tailorings
Browse files Browse the repository at this point in the history
  • Loading branch information
skateman authored and romanblanco committed Aug 5, 2024
1 parent c38f252 commit 7c89a5f
Show file tree
Hide file tree
Showing 5 changed files with 4,556 additions and 4,370 deletions.
4 changes: 4 additions & 0 deletions app/models/v2/tailoring.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ def security_guide_id
attributes['profile__security_guide_id'] || try(:profile)&.security_guide_id
end

def security_guide_version
attributes['profile__security_guide_version'] || try(:security_guide)&.version
end

def rule_group_ref_ids
base = V2::RuleGroup.where(id: rules_added.reselect(:rule_group_id))
base.or(V2::RuleGroup.where(id: base.select(GROUP_ANCESTRY_IDS)))
Expand Down
1 change: 1 addition & 0 deletions app/serializers/v2/tailoring_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ class TailoringSerializer < V2::ApplicationSerializer

derived_attribute :os_major_version, security_guide: [:os_major_version]
derived_attribute :security_guide_id, profile: [:security_guide_id]
derived_attribute :security_guide_version, security_guide: [:version]
end
end
6 changes: 6 additions & 0 deletions spec/api/v2/schemas/tailoring.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ module Tailoring
readOnly: true,
description: 'Identificator of the Security Guide that contains the parent Profile'
},
security_guide_version: {
type: :string,
examples: ['0.1.210'],
readOnly: true,
description: 'Version of the Security Guide that contains the parent Profile'
},
os_major_version: {
type: :number,
examples: [7],
Expand Down
1 change: 1 addition & 0 deletions spec/controllers/v2/tailorings_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
{
profile_id: :profile_id,
security_guide_id: :security_guide_id,
security_guide_version: :security_guide_version,
value_overrides: :value_overrides,
os_minor_version: :os_minor_version,
os_major_version: :os_major_version
Expand Down
Loading

0 comments on commit 7c89a5f

Please sign in to comment.