mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
IcingaServiceForm: protect against branched objects
...w/o id. Can be improved
This commit is contained in:
parent
4d2f285c01
commit
3c8bb6bd16
@ -224,13 +224,19 @@ class IcingaServiceForm extends DirectorObjectForm
|
||||
|
||||
if ($this->blacklisted === null) {
|
||||
$host = $this->host;
|
||||
// Safety check, branches
|
||||
$hostId = $host->get('id');
|
||||
$service = $this->getServiceToBeBlacklisted();
|
||||
$serviceId = $service->get('id');
|
||||
if (! $hostId || ! $serviceId) {
|
||||
return false;
|
||||
}
|
||||
$db = $this->db->getDbAdapter();
|
||||
if ($this->providesOverrides()) {
|
||||
$this->blacklisted = 1 === (int)$db->fetchOne(
|
||||
$db->select()->from('icinga_host_service_blacklist', 'COUNT(*)')
|
||||
->where('host_id = ?', $host->get('id'))
|
||||
->where('service_id = ?', $service->get('id'))
|
||||
->where('host_id = ?', $hostId)
|
||||
->where('service_id = ?', $serviceId)
|
||||
);
|
||||
} else {
|
||||
$this->blacklisted = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user