2016-03-09 20:53:57 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Icinga\Module\Director\Objects;
|
|
|
|
|
2018-10-08 06:30:31 +02:00
|
|
|
use Icinga\Module\Director\DirectorObject\Automation\ExportInterface;
|
|
|
|
|
|
|
|
abstract class IcingaObjectGroup extends IcingaObject implements ExportInterface
|
2016-03-09 20:53:57 +01:00
|
|
|
{
|
|
|
|
protected $supportsImports = true;
|
|
|
|
|
2016-10-13 15:44:53 +02:00
|
|
|
protected $supportedInLegacy = true;
|
|
|
|
|
2021-10-05 18:19:01 +02:00
|
|
|
protected $uuidColumn = 'uuid';
|
|
|
|
|
2018-06-08 20:45:02 +02:00
|
|
|
protected $defaultProperties = [
|
2016-10-24 05:41:37 +02:00
|
|
|
'id' => null,
|
2021-10-05 18:19:01 +02:00
|
|
|
'uuid' => null,
|
2016-10-24 05:41:37 +02:00
|
|
|
'object_name' => null,
|
|
|
|
'object_type' => null,
|
|
|
|
'disabled' => 'n',
|
|
|
|
'display_name' => null,
|
|
|
|
'assign_filter' => null,
|
2018-06-08 20:45:02 +02:00
|
|
|
];
|
2016-05-02 10:26:41 +02:00
|
|
|
|
2023-07-30 17:31:23 +02:00
|
|
|
protected $memberShipShouldBeRefreshed = false;
|
|
|
|
|
2018-10-08 06:30:31 +02:00
|
|
|
public function getUniqueIdentifier()
|
|
|
|
{
|
|
|
|
return $this->getObjectName();
|
|
|
|
}
|
|
|
|
|
2018-07-13 10:35:28 +02:00
|
|
|
protected function prefersGlobalZone()
|
2016-05-02 10:26:41 +02:00
|
|
|
{
|
2018-07-13 10:35:28 +02:00
|
|
|
return true;
|
2016-05-02 10:26:41 +02:00
|
|
|
}
|
2023-04-21 16:03:58 +02:00
|
|
|
|
2023-07-30 17:31:23 +02:00
|
|
|
protected function beforeStore()
|
2023-04-21 16:03:58 +02:00
|
|
|
{
|
2023-07-30 17:31:23 +02:00
|
|
|
parent::beforeStore();
|
2023-04-21 16:03:58 +02:00
|
|
|
if ($this->hasBeenLoadedFromDb()) {
|
|
|
|
if (!array_key_exists('assign_filter', $this->getModifiedProperties())) {
|
2023-07-30 17:31:23 +02:00
|
|
|
$this->memberShipShouldBeRefreshed = false;
|
|
|
|
return;
|
2023-04-21 16:03:58 +02:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if ($this->get('assign_filter') === null) {
|
2023-07-30 17:31:23 +02:00
|
|
|
$this->memberShipShouldBeRefreshed = false;
|
|
|
|
return;
|
2023-04-21 16:03:58 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-30 17:31:23 +02:00
|
|
|
$this->memberShipShouldBeRefreshed = true;
|
2023-04-21 16:03:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
protected function notifyResolvers()
|
|
|
|
{
|
2023-07-30 17:31:23 +02:00
|
|
|
if ($this->memberShipShouldBeRefreshed) {
|
2023-04-21 16:03:58 +02:00
|
|
|
$resolver = $this->getMemberShipResolver();
|
|
|
|
$resolver->addGroup($this);
|
|
|
|
$resolver->refreshDb();
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getMemberShipResolver()
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
2016-03-09 20:53:57 +01:00
|
|
|
}
|