Add imports support for UserGroup

This commit is contained in:
Alexander Fuhr 2015-06-29 11:02:30 +02:00
parent 61812d6115
commit f1c3f9025b
6 changed files with 84 additions and 0 deletions

View File

@ -42,5 +42,10 @@ class IcingaUserGroupForm extends DirectorObjectForm
'label' => $this->translate('Cluster Zone'),
'description' => $this->translate('Check this usergroup in this specific Icinga cluster zone')
));
$this->addElement('text', 'imports', array(
'label' => $this->translate('Imports'),
'description' => $this->translate('The inherited usergroup template names')
));
}
}

View File

@ -6,6 +6,8 @@ class IcingaUserGroup extends IcingaObject
{
protected $table = 'icinga_usergroup';
protected $supportsImports = true;
protected $defaultProperties = array(
'id' => null,
'object_name' => null,

View File

@ -0,0 +1,17 @@
CREATE TABLE icinga_usergroup_inheritance (
usergroup_id INT(10) UNSIGNED NOT NULL,
parent_usergroup_id INT(10) UNSIGNED NOT NULL,
weight MEDIUMINT UNSIGNED DEFAULT NULL,
PRIMARY KEY (usergroup_id, parent_usergroup_id),
UNIQUE KEY unique_order (usergroup_id, weight),
CONSTRAINT icinga_usergroup_inheritance_usergroup
FOREIGN KEY usergroup (usergroup_id)
REFERENCES icinga_usergroup (id)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT icinga_usergroup_inheritance_parent_usergroup
FOREIGN KEY usergroup (parent_usergroup_id)
REFERENCES icinga_usergroup (id)
ON DELETE RESTRICT
ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -695,6 +695,24 @@ CREATE TABLE icinga_usergroup (
KEY search_idx (display_name)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE icinga_usergroup_inheritance (
usergroup_id INT(10) UNSIGNED NOT NULL,
parent_usergroup_id INT(10) UNSIGNED NOT NULL,
weight MEDIUMINT UNSIGNED DEFAULT NULL,
PRIMARY KEY (usergroup_id, parent_usergroup_id),
UNIQUE KEY unique_order (usergroup_id, weight),
CONSTRAINT icinga_usergroup_inheritance_usergroup
FOREIGN KEY usergroup (usergroup_id)
REFERENCES icinga_usergroup (id)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT icinga_usergroup_inheritance_parent_usergroup
FOREIGN KEY usergroup (parent_usergroup_id)
REFERENCES icinga_usergroup (id)
ON DELETE RESTRICT
ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE icinga_usergroup_user (
usergroup_id INT(10) UNSIGNED NOT NULL,
user_id INT(10) UNSIGNED NOT NULL,

View File

@ -0,0 +1,20 @@
CREATE TABLE icinga_usergroup_inheritance (
usergroup_id integer NOT NULL,
parent_usergroup_id integer NOT NULL,
weight integer DEFAULT NULL,
PRIMARY KEY (usergroup_id, parent_usergroup_id),
CONSTRAINT icinga_usergroup_inheritance_usergroup
FOREIGN KEY (usergroup_id)
REFERENCES icinga_usergroup (id)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT icinga_usergroup_inheritance_parent_usergroup
FOREIGN KEY (parent_usergroup_id)
REFERENCES icinga_usergroup (id)
ON DELETE RESTRICT
ON UPDATE CASCADE
);
CREATE UNIQUE INDEX usergroup_inheritance_unique_order ON icinga_usergroup_inheritance (usergroup_id, weight);
CREATE INDEX usergroup_inheritance_usergroup ON icinga_usergroup_inheritance (usergroup_id);
CREATE INDEX usergroup_inheritance_usergroup_parent ON icinga_usergroup_inheritance (parent_usergroup_id);

View File

@ -832,6 +832,28 @@ CREATE UNIQUE INDEX usergroup_search_idx ON icinga_usergroup (display_name);
CREATE INDEX usergroup_object_name ON icinga_usergroup (object_name, zone_id);
CREATE TABLE icinga_usergroup_inheritance (
usergroup_id integer NOT NULL,
parent_usergroup_id integer NOT NULL,
weight integer DEFAULT NULL,
PRIMARY KEY (usergroup_id, parent_usergroup_id),
CONSTRAINT icinga_usergroup_inheritance_usergroup
FOREIGN KEY (usergroup_id)
REFERENCES icinga_usergroup (id)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT icinga_usergroup_inheritance_parent_usergroup
FOREIGN KEY (parent_usergroup_id)
REFERENCES icinga_usergroup (id)
ON DELETE RESTRICT
ON UPDATE CASCADE
);
CREATE UNIQUE INDEX usergroup_inheritance_unique_order ON icinga_usergroup_inheritance (usergroup_id, weight);
CREATE INDEX usergroup_inheritance_usergroup ON icinga_usergroup_inheritance (usergroup_id);
CREATE INDEX usergroup_inheritance_usergroup_parent ON icinga_usergroup_inheritance (parent_usergroup_id);
CREATE TABLE icinga_usergroup_user (
usergroup_id integer NOT NULL,
user_id integer NOT NULL,