parent
137a21b7e2
commit
014f9b9dbe
|
@ -6,6 +6,9 @@ use Icinga\Module\Director\Web\Form\DirectorObjectForm;
|
||||||
|
|
||||||
class IcingaUserGroupForm extends DirectorObjectForm
|
class IcingaUserGroupForm extends DirectorObjectForm
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @throws \Zend_Form_Exception
|
||||||
|
*/
|
||||||
public function setup()
|
public function setup()
|
||||||
{
|
{
|
||||||
$this->addHidden('object_type', 'object');
|
$this->addHidden('object_type', 'object');
|
||||||
|
@ -17,24 +20,27 @@ class IcingaUserGroupForm extends DirectorObjectForm
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->addGroupDisplayNameElement()
|
$this->addGroupDisplayNameElement()
|
||||||
// TODO: re-add this once we have zone_id in groups tables
|
->addZoneElements()
|
||||||
// ->addZoneElements()
|
|
||||||
->groupMainProperties()
|
->groupMainProperties()
|
||||||
->setButtons();
|
->setButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return $this
|
||||||
|
* @throws \Zend_Form_Exception
|
||||||
|
*/
|
||||||
protected function addZoneElements()
|
protected function addZoneElements()
|
||||||
{
|
{
|
||||||
$this->addZoneElement();
|
$this->addZoneElement(true);
|
||||||
$this->addDisplayGroup(array('zone_id'), 'clustering', array(
|
$this->addDisplayGroup(['zone_id'], 'clustering', [
|
||||||
'decorators' => array(
|
'decorators' => [
|
||||||
'FormElements',
|
'FormElements',
|
||||||
array('HtmlTag', array('tag' => 'dl')),
|
['HtmlTag', ['tag' => 'dl']],
|
||||||
'Fieldset',
|
'Fieldset',
|
||||||
),
|
],
|
||||||
'order' => 80,
|
'order' => 80,
|
||||||
'legend' => $this->translate('Zone settings')
|
'legend' => $this->translate('Zone settings')
|
||||||
));
|
]);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ before switching to a new version.
|
||||||
single hosts (#907)
|
single hosts (#907)
|
||||||
* FEATURE: timestamped startup log rendering for upcoming Icinga v2.9.0 (#1478)
|
* FEATURE: timestamped startup log rendering for upcoming Icinga v2.9.0 (#1478)
|
||||||
* FEATURE: allow to switch between multiple Director databases (#1498)
|
* FEATURE: allow to switch between multiple Director databases (#1498)
|
||||||
|
* FEATURE: it's now possible to specify Zones for UserGroups (#1163)
|
||||||
|
|
||||||
### User Interface
|
### User Interface
|
||||||
* FEATURE: Admins have now access to JSON download links in many places
|
* FEATURE: Admins have now access to JSON download links in many places
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
namespace Icinga\Module\Director\Objects;
|
namespace Icinga\Module\Director\Objects;
|
||||||
|
|
||||||
use Icinga\Module\Director\IcingaConfig\IcingaConfig;
|
|
||||||
|
|
||||||
abstract class IcingaObjectGroup extends IcingaObject
|
abstract class IcingaObjectGroup extends IcingaObject
|
||||||
{
|
{
|
||||||
protected $supportsImports = true;
|
protected $supportsImports = true;
|
||||||
|
@ -19,8 +17,8 @@ abstract class IcingaObjectGroup extends IcingaObject
|
||||||
'assign_filter' => null,
|
'assign_filter' => null,
|
||||||
];
|
];
|
||||||
|
|
||||||
public function getRenderingZone(IcingaConfig $config = null)
|
protected function prefersGlobalZone()
|
||||||
{
|
{
|
||||||
return $this->connection->getDefaultGlobalZoneName();
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
namespace Icinga\Module\Director\Objects;
|
namespace Icinga\Module\Director\Objects;
|
||||||
|
|
||||||
use Icinga\Module\Director\IcingaConfig\IcingaConfig;
|
|
||||||
|
|
||||||
class IcingaUserGroup extends IcingaObjectGroup
|
class IcingaUserGroup extends IcingaObjectGroup
|
||||||
{
|
{
|
||||||
protected $table = 'icinga_usergroup';
|
protected $table = 'icinga_usergroup';
|
||||||
|
@ -14,10 +12,10 @@ class IcingaUserGroup extends IcingaObjectGroup
|
||||||
'object_type' => null,
|
'object_type' => null,
|
||||||
'disabled' => 'n',
|
'disabled' => 'n',
|
||||||
'display_name' => null,
|
'display_name' => null,
|
||||||
|
'zone_id' => null,
|
||||||
];
|
];
|
||||||
|
|
||||||
public function getRenderingZone(IcingaConfig $config = null)
|
protected $relations = [
|
||||||
{
|
'zone' => 'IcingaZone',
|
||||||
return $this->connection->getMasterZoneName();
|
];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
ALTER TABLE icinga_usergroup
|
||||||
|
ADD COLUMN zone_id INT(10) UNSIGNED DEFAULT NULL,
|
||||||
|
ADD CONSTRAINT icinga_usergroup_zone
|
||||||
|
FOREIGN KEY zone (zone_id)
|
||||||
|
REFERENCES icinga_zone (id)
|
||||||
|
ON DELETE RESTRICT
|
||||||
|
ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
INSERT INTO director_schema_migration
|
||||||
|
(schema_version, migration_time)
|
||||||
|
VALUES (149, NOW());
|
|
@ -1044,9 +1044,15 @@ CREATE TABLE icinga_usergroup (
|
||||||
object_type ENUM('object', 'template') NOT NULL,
|
object_type ENUM('object', 'template') NOT NULL,
|
||||||
disabled ENUM('y', 'n') NOT NULL DEFAULT 'n',
|
disabled ENUM('y', 'n') NOT NULL DEFAULT 'n',
|
||||||
display_name VARCHAR(255) DEFAULT NULL,
|
display_name VARCHAR(255) DEFAULT NULL,
|
||||||
|
zone_id INT(10) UNSIGNED DEFAULT NULL,
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
UNIQUE INDEX object_name (object_name),
|
UNIQUE INDEX object_name (object_name),
|
||||||
KEY search_idx (display_name)
|
KEY search_idx (display_name),
|
||||||
|
CONSTRAINT icinga_usergroup_zone
|
||||||
|
FOREIGN KEY zone (zone_id)
|
||||||
|
REFERENCES icinga_zone (id)
|
||||||
|
ON DELETE RESTRICT
|
||||||
|
ON UPDATE CASCADE
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
CREATE TABLE icinga_usergroup_inheritance (
|
CREATE TABLE icinga_usergroup_inheritance (
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
ALTER TABLE icinga_usergroup
|
||||||
|
ADD COLUMN zone_id integer DEFAULT NULL,
|
||||||
|
ADD CONSTRAINT icinga_usergroup_zone
|
||||||
|
FOREIGN KEY (zone_id)
|
||||||
|
REFERENCES icinga_zone (id)
|
||||||
|
ON DELETE RESTRICT
|
||||||
|
ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
CREATE INDEX usergroup_zone ON icinga_usergroup (zone_id);
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO director_schema_migration
|
||||||
|
(schema_version, migration_time)
|
||||||
|
VALUES (149, NOW());
|
|
@ -1267,11 +1267,18 @@ CREATE TABLE icinga_usergroup (
|
||||||
object_type enum_object_type_all NOT NULL,
|
object_type enum_object_type_all NOT NULL,
|
||||||
disabled enum_boolean NOT NULL DEFAULT 'n',
|
disabled enum_boolean NOT NULL DEFAULT 'n',
|
||||||
display_name character varying(255) DEFAULT NULL,
|
display_name character varying(255) DEFAULT NULL,
|
||||||
PRIMARY KEY (id)
|
zone_id integer DEFAULT NULL,
|
||||||
|
PRIMARY KEY (id),
|
||||||
|
CONSTRAINT icinga_usergroup_zone
|
||||||
|
FOREIGN KEY (zone_id)
|
||||||
|
REFERENCES icinga_zone (id)
|
||||||
|
ON DELETE RESTRICT
|
||||||
|
ON UPDATE CASCADE
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE UNIQUE INDEX usergroup_search_idx ON icinga_usergroup (display_name);
|
CREATE UNIQUE INDEX usergroup_search_idx ON icinga_usergroup (display_name);
|
||||||
CREATE INDEX usergroup_object_name ON icinga_usergroup (object_name);
|
CREATE INDEX usergroup_object_name ON icinga_usergroup (object_name);
|
||||||
|
CREATE INDEX usergroup_zone ON icinga_usergroup (zone_id);
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE icinga_usergroup_inheritance (
|
CREATE TABLE icinga_usergroup_inheritance (
|
||||||
|
|
Loading…
Reference in New Issue