blob: c076f525da87a8420adf2f4759494677e7ac0ef7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
<?php
namespace Icinga\Module\Director\Objects;
use Icinga\Module\Director\DirectorObject\Automation\ExportInterface;
abstract class IcingaObjectGroup extends IcingaObject implements ExportInterface
{
protected $supportsImports = true;
protected $supportedInLegacy = true;
protected $uuidColumn = 'uuid';
protected $defaultProperties = [
'id' => null,
'uuid' => null,
'object_name' => null,
'object_type' => null,
'disabled' => 'n',
'display_name' => null,
'assign_filter' => null,
];
protected $memberShipShouldBeRefreshed = false;
public function getUniqueIdentifier()
{
return $this->getObjectName();
}
protected function prefersGlobalZone()
{
return true;
}
protected function beforeStore()
{
parent::beforeStore();
if ($this->hasBeenLoadedFromDb()) {
if (!array_key_exists('assign_filter', $this->getModifiedProperties())) {
$this->memberShipShouldBeRefreshed = false;
return;
}
} else {
if ($this->hasProperty('assign_filter') && $this->get('assign_filter') === null) {
$this->memberShipShouldBeRefreshed = false;
return;
}
}
if ($this->hasProperty('assign_filter')) {
$this->memberShipShouldBeRefreshed = true;
}
}
protected function notifyResolvers()
{
if ($this->memberShipShouldBeRefreshed) {
$resolver = $this->getMemberShipResolver();
$resolver->addGroup($this);
$resolver->refreshDb();
}
return $this;
}
protected function getMemberShipResolver()
{
return null;
}
}
|