Skip to content

Commit

Permalink
fix(APIv2): RHINENG-11984 swap conditions for safer checks
Browse files Browse the repository at this point in the history
  • Loading branch information
skateman committed Aug 20, 2024
1 parent 1092f62 commit 50ee9cf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/v2/system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ def self.first_group_name(table = arel_table)

searchable_by :profile_ref_ids, %i[neq notin] do |_key, _op, val|
values = val.split.map(&:strip)
ids = ::V2::PolicySystem.joins(policy: :profile).where.not(profile: { ref_id: values }).select(:system_id)
ids = ::V2::PolicySystem.joins(policy: :profile).where(profile: { ref_id: values }).select(:system_id)

{ conditions: "inventory.hosts.id IN (#{ids.to_sql})" }
{ conditions: "inventory.hosts.id NOT IN (#{ids.to_sql})" }
end

scope :with_groups, lambda { |groups, key = :id|
Expand Down

0 comments on commit 50ee9cf

Please sign in to comment.