[icinga-checkins] icinga.org: icingaweb2-module-director/master: IcingaUser: remove obsolete states stub

git at icinga.org git at icinga.org
Mon Feb 29 20:39:05 CET 2016


Module: icingaweb2-module-director
Branch: master
Commit: 62c1aec917d32b3e137f174f67bb7e3112c442ab
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=62c1aec917d32b3e137f174f67bb7e3112c442ab

Author: Thomas Gelf <thomas at gelf.net>
Date:   Mon Feb 29 18:29:18 2016 +0100

IcingaUser: remove obsolete states stub

---

 library/Director/Objects/IcingaUser.php |   15 ++++-----------
 schema/mysql-migrations/upgrade_76.sql  |   28 ++++++++++++++++++++++++++++
 schema/mysql.sql                        |    6 +++---
 3 files changed, 35 insertions(+), 14 deletions(-)

diff --git a/library/Director/Objects/IcingaUser.php b/library/Director/Objects/IcingaUser.php
index a416c48..a04622c 100644
--- a/library/Director/Objects/IcingaUser.php
+++ b/library/Director/Objects/IcingaUser.php
@@ -29,15 +29,8 @@ class IcingaUser extends IcingaObject
         'enable_notifications' => 'enable_notifications'
     );
 
-    protected $states = array();
-
-    protected function setStates($value)
-    {
-        $states = $value;
-        sort($states);
-        if ($this->states !== $states) {
-            $this->states = $states;
-            $this->hasBeenModified = true;
-        }
-    }
+    protected $relatedSets = array(
+        'states' => 'StateFilterSet',
+        'types'  => 'TypeFilterSet',
+    );
 }
diff --git a/schema/mysql-migrations/upgrade_76.sql b/schema/mysql-migrations/upgrade_76.sql
new file mode 100644
index 0000000..a2c1d51
--- /dev/null
+++ b/schema/mysql-migrations/upgrade_76.sql
@@ -0,0 +1,28 @@
+DROP TABLE icinga_user_filters_set;
+
+CREATE TABLE icinga_user_types_set (
+  user_id INT(10) UNSIGNED NOT NULL,
+  property ENUM(
+    'DowntimeStart',
+    'DowntimeEnd',
+    'DowntimeRemoved',
+    'Custom',
+    'Acknowledgement',
+    'Problem',
+    'Recovery',
+    'FlappingStart',
+    'FlappingEnd'
+  ) NOT NULL,
+  merge_behaviour ENUM('override', 'extend', 'blacklist') NOT NULL DEFAULT 'override'
+    COMMENT 'override: = [], extend: += [], blacklist: -= []',
+  PRIMARY KEY (user_id, property, merge_behaviour),
+  CONSTRAINT icinga_user_types_set_user
+    FOREIGN KEY icinga_user (user_id)
+    REFERENCES icinga_user (id)
+    ON DELETE CASCADE
+    ON UPDATE CASCADE
+) ENGINE=InnoDB;
+
+INSERT INTO director_schema_migration
+  SET migration_time = NOW(),
+      schema_version = 76;
diff --git a/schema/mysql.sql b/schema/mysql.sql
index 2853557..8db7fba 100644
--- a/schema/mysql.sql
+++ b/schema/mysql.sql
@@ -799,7 +799,7 @@ CREATE TABLE icinga_user_states_set (
     ON UPDATE CASCADE
 )  ENGINE=InnoDB;
 
-CREATE TABLE icinga_user_filters_set (
+CREATE TABLE icinga_user_types_set (
   user_id INT(10) UNSIGNED NOT NULL,
   property ENUM(
     'DowntimeStart',
@@ -815,7 +815,7 @@ CREATE TABLE icinga_user_filters_set (
   merge_behaviour ENUM('override', 'extend', 'blacklist') NOT NULL DEFAULT 'override'
     COMMENT 'override: = [], extend: += [], blacklist: -= []',
   PRIMARY KEY (user_id, property, merge_behaviour),
-  CONSTRAINT icinga_user_filters_set_user
+  CONSTRAINT icinga_user_types_set_user
     FOREIGN KEY icinga_user (user_id)
     REFERENCES icinga_user (id)
     ON DELETE CASCADE
@@ -1112,4 +1112,4 @@ CREATE TABLE sync_run (
 
 INSERT INTO director_schema_migration
   SET migration_time = NOW(),
-      schema_version = 75;
+      schema_version = 76;



More information about the icinga-checkins mailing list