Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(APIv2): RHINENG-11782 expose security_guide version in tailorings #2173

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading