Implements support for roles (attacker/victim) filtering of alerts

Implements #5425
This commit is contained in:
Simone Mainardi 2021-05-31 12:32:56 +02:00
parent 756966c62b
commit 08fb295be9
12 changed files with 81 additions and 17 deletions

View file

@ -13,6 +13,7 @@ local format_utils = require "format_utils"
local alert_consts = require "alert_consts"
local alert_utils = require "alert_utils"
local alert_severities = require "alert_severities"
local alert_roles = require "alert_roles"
-- ##############################################
@ -291,9 +292,11 @@ function alert_store:select_engaged(filter)
local severity_filter = tonumber(self._alert_severity)
local entity_id_filter = tonumber(self._alert_entity and self._alert_entity.entity_id) -- Possibly set in subclasses constructor
local entity_value_filter = filter or self._entity_value
-- Role is currently supported and populated for hosts engaged alerts.
local role_filter = tonumber(self._role) or alert_roles.alert_role_any.role_id
-- tprint(string.format("id=%s sev=%s entity=%s val=%s", alert_id_filter, severity_filter, entity_id_filter, entity_value_filter))
local alerts = interface.getEngagedAlerts(entity_id_filter, entity_value_filter, alert_id_filter, severity_filter)
local alerts = interface.getEngagedAlerts(entity_id_filter, entity_value_filter, alert_id_filter, severity_filter, role_filter)
local total_rows = 0
local sort_2_col = {}