Yeh
This commit is contained in:
@@ -46,8 +46,23 @@ class Api::EventsController < ApplicationController
|
||||
rules = Rule.active.sync_order
|
||||
end
|
||||
|
||||
response_data[:rules] = rules.map(&:to_agent_format)
|
||||
agent_rules = rules.map(&:to_agent_format)
|
||||
response_data[:rules] = agent_rules
|
||||
response_data[:rules_changed] = true
|
||||
|
||||
# Include path segments dictionary for path_pattern rules
|
||||
path_segment_ids = agent_rules
|
||||
.select { |r| r[:waf_rule_type] == 'path_pattern' }
|
||||
.flat_map { |r| r.dig(:conditions, :segment_ids) }
|
||||
.compact
|
||||
.uniq
|
||||
|
||||
if path_segment_ids.any?
|
||||
response_data[:path_segments] = PathSegment
|
||||
.where(id: path_segment_ids)
|
||||
.pluck(:id, :segment)
|
||||
.to_h
|
||||
end
|
||||
else
|
||||
response_data[:rules_changed] = false
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user