Hello community,

here is the log from the commit of package icingaweb2-module-director for 
openSUSE:Factory checked in at 2018-11-10 16:58:56
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/icingaweb2-module-director (Old)
 and      /work/SRC/openSUSE:Factory/.icingaweb2-module-director.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "icingaweb2-module-director"

Sat Nov 10 16:58:56 2018 rev:6 rq:645952 version:1.5.2

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/icingaweb2-module-director/icingaweb2-module-director.changes
    2018-08-15 10:38:27.632298886 +0200
+++ 
/work/SRC/openSUSE:Factory/.icingaweb2-module-director.new/icingaweb2-module-director.changes
       2018-11-10 17:00:53.499642566 +0100
@@ -1,0 +2,21 @@
+Thu Nov  1 22:10:32 UTC 2018 - [email protected]
+
+- update to 1.5.2
+  * Fixed issues
+    - You can find issues and feature requests related to this 
+      release on our roadmap
+  * Configuration rendering
+    - FIX: Fix compatibility with Icinga v2.6, got broken with 
+      v1.5.0 (#1614)
+  * REST API
+    - FIX: No more invalid JSON in some special circumstances 
+      (#1314)
+  * User Interface
+    - FIX: Hostgroup assignment cache has been fixed (#1574, #1618)
+  * DB Schema
+    - FIX: missing user/timeperiod constraint. We usually do not 
+      touch the schema in minor versions, this has been 
+      cherry-picked by accident. However, don't worry - the 
+      migration has been tested intensively.
+
+-------------------------------------------------------------------
@@ -6,2 +27,3 @@
-    - You can find issues and feature requests related to this release on our
-      
[roadmap](https://github.com/Icinga/icingaweb2-module-director/milestone/16?closed=1)
+    - You can find issues and feature requests related to this 
+      release on our [roadmap]
+      
(https://github.com/Icinga/icingaweb2-module-director/milestone/16?closed=1)
@@ -9 +31,2 @@
-    - FIX: Switched Variable-Override related constant names broke the feature 
(#1601)
+    - FIX: Switched Variable-Override related constant names broke 
+      the feature (#1601)
@@ -11,2 +34,3 @@
-    - FIX: Custom Fields attached to a Service Template have not been shown 
for Apply
-      Rules whose name matched the Template Name (#1602)
+    - FIX: Custom Fields attached to a Service Template have not
+      been shown for Apply Rules whose name matched the Template 
+      Name (#1602)
@@ -14 +38,2 @@
-    - FIX: There was an issue with specific binary checksums on MySQL (#1556)
+    - FIX: There was an issue with specific binary checksums on 
+      MySQL (#1556)
@@ -21,2 +46,3 @@
-    - You can find issues and feature requests related to this release on our
-      
[roadmap](https://github.com/Icinga/icingaweb2-module-director/milestone/11?closed=1)
+    - You can find issues and feature requests related to this 
+      release on our [roadmap]
+      
(https://github.com/Icinga/icingaweb2-module-director/milestone/11?closed=1)
@@ -24,2 +50,3 @@
-    - FIX: users with `director/audit` permission had the possibility to 
inject SQL.
-      Thanks to Boyd Ansems for reporting this.
+    - FIX: users with `director/audit` permission had the 
+      possibility to inject SQL. Thanks to Boyd Ansems for 
+      reporting this.
@@ -27 +54,2 @@
-    - FEATURE: Showing the executed SQL query now requires the `showsql` 
permission
+    - FEATURE: Showing the executed SQL query now requires the 
+      `showsql` permission
@@ -29,3 +57,5 @@
-    - FIX: do not allow a user to create hosts he wouldn't be allowed to see 
#1451
-    - FIX: Hostgroup-based restrictions worked fine when applied, bug was 
buggy in
-      combination with directly assigned or inherited groups (#1464)
+    - FIX: do not allow a user to create hosts he wouldn't be 
+      allowed to see #1451
+    - FIX: Hostgroup-based restrictions worked fine when applied,
+      bug was buggy in combination with directly assigned or 
+      inherited groups (#1464)
@@ -33,8 +63,14 @@
-    - FEATURE: Add 'is false (or not set)' condition for apply rules (#1436)
-    - FEATURE: support flapping settings for Icinga >= 2.8.0 (#330)
-    - FEATURE: include all itl packages in Linux Agent sample config (#1450)
-    - FEATURE: it's now possible to blacklist inherited or applied Services on
-      single hosts (#907)
-    - FEATURE: timestamped startup log rendering for upcoming Icinga v2.9.0 
(#1478)
-    - FEATURE: allow to switch between multiple Director databases (#1498)
-    - FEATURE: it's now possible to specify Zones for UserGroups (#1163)
+    - FEATURE: Add 'is false (or not set)' condition for apply 
+      rules (#1436)
+    - FEATURE: support flapping settings for Icinga >= 2.8.0
+      (#330)
+    - FEATURE: include all itl packages in Linux Agent sample 
+      config (#1450)
+    - FEATURE: it's now possible to blacklist inherited or applied 
+      Services on single hosts (#907)
+    - FEATURE: timestamped startup log rendering for upcoming
+      Icinga v2.9.0 (#1478)
+    - FEATURE: allow to switch between multiple Director databases 
+      (#1498)
+    - FEATURE: it's now possible to specify Zones for UserGroups
+      (#1163)
@@ -43,3 +79,6 @@
-    - FEATURE: Admins have now access to JSON download links in many places
-    - FEATURE: Users equipped with related permissions can toggle "Show SQL" 
in the GUI
-    - FEATURE: A Service Set can now be assigned to multiple hosts at once 
#1281
+    - FEATURE: Admins have now access to JSON download links in 
+      many places
+    - FEATURE: Users equipped with related permissions can toggle
+      "Show SQL" in the GUI
+    - FEATURE: A Service Set can now be assigned to multiple hosts 
+      at once #1281
@@ -47,2 +86,4 @@
-    - FEATURE: Show usage of Commands over templates and objects (#335)
-    - FEATURE: Allow horizontal size increase of Import Source DB Query field 
(#299)
+    - FEATURE: Show usage of Commands over templates and objects
+      (#335)
+    - FEATURE: Allow horizontal size increase of Import Source 
+      DB Query field (#299)
@@ -50,5 +91,9 @@
-    - FEATURE: Data Lists can be chosen by name in Sync rules (#1048)
-    - FEATURE: Inspect feature got refactored, also for Services (#264, #689, 
#1396, #1397)
-    - FEATURE: The "Modify" hook is now available for Services (#689), 
regardless
-      of whether they have been directly assigned, inherited or applied
-    - FEATURE: Config preview links imports, hosts and commands to related 
objects (#1521)
+    - FEATURE: Data Lists can be chosen by name in Sync rules 
+      (#1048)
+    - FEATURE: Inspect feature got refactored, also for Services 
+      (#264, #689, #1396, #1397)
+    - FEATURE: The "Modify" hook is now available for Services 
+      (#689), regardless of whether they have been directly
+      assigned, inherited or applied
+    - FEATURE: Config preview links imports, hosts and commands to 
+      related objects (#1521)
@@ -56,10 +101,18 @@
-    - FEATURE: Apply Rule editor shows suggestions for Data-List vars (#1588)
-    - FIX: Don't suggest Command templates where Commands are required (#1414)
-    - FIX: Do not allow to delete Commands being used by other objects (#1443)
-    - FIX: Show 'Inspect' tab only for Endpoints with an ApiUser (#1293)
-    - FIX: It's now possible to specify TimePeriods for single Users #944
-    - FIX: Redirect after not modifying a Command Argument failed on some RHEL 
7
-      setups (#1512)
-    - FIX: click on Service Set titles no longer removes them from their host 
(#1560)
-    - FIX: Restoring objects based on compound keys has been fixed (#1597)
-    - FIX: Linux Agent kickstart script improved and tweaked for Icinga 2.9 
(#1596)
+    - FEATURE: Apply Rule editor shows suggestions for Data-List 
+      vars (#1588)
+    - FIX: Don't suggest Command templates where Commands are 
+      required (#1414)
+    - FIX: Do not allow to delete Commands being used by other 
+      objects (#1443)
+    - FIX: Show 'Inspect' tab only for Endpoints with an ApiUser
+      (#1293)
+    - FIX: It's now possible to specify TimePeriods for single 
+      Users #944
+    - FIX: Redirect after not modifying a Command Argument failed 
+      on some RHEL 7 setups (#1512)
+    - FIX: click on Service Set titles no longer removes them from 
+      their host (#1560)
+    - FIX: Restoring objects based on compound keys has been fixed
+      (#1597)
+    - FIX: Linux Agent kickstart script improved and tweaked for 
+      Icinga 2.9 (#1596)
@@ -71,5 +124,8 @@
-    - FIX: Sync is very powerful and allows for actions not available in the 
GUI. It
-      however allowed to store invalid single Service Objects with no Host. 
This is
-      now illegal, as it never makes any sense
-    - FIX: Performance boost for "purge" on older MySQL/MariaDB systems (#1475)
-    - FEATURE: new Property Modifier for IPs formatted as number in Excel 
files (#1296)
+    - FIX: Sync is very powerful and allows for actions not 
+      available in the GUI. It however allowed to store invalid 
+      single Service Objects with no Host. This is now illegal,
+      as it never makes any sense
+    - FIX: Performance boost for "purge" on older MySQL/MariaDB 
+      systems (#1475)
+    - FEATURE: new Property Modifier for IPs formatted as number 
+      in Excel files (#1296)
@@ -77,3 +133,6 @@
-    - FEATURE: new Property Modifier: uppercase the first character of each 
word
-    - FEATURE: Kickstart Helper now also imports Event Commands (#1389)
-    - FEATURE: Preserve _override_servicevars on sync, even when replacing 
vars (#1307)
+    - FEATURE: new Property Modifier: uppercase the first character 
+      of each word
+    - FEATURE: Kickstart Helper now also imports Event Commands 
+      (#1389)
+    - FEATURE: Preserve _override_servicevars on sync, 
+      even when replacing vars (#1307)
@@ -81,2 +140,2 @@
-    - FIX: problems related to users working from different time zones have 
been
-      fixed (#1270, #1332)
+    - FIX: problems related to users working from different time 
+      zones have been fixed (#1270, #1332)
@@ -84 +143,2 @@
-    - FEATURE: Html/Attribute allows colons in attribute names (required for 
SVGs)
+    - FEATURE: Html/Attribute allows colons in attribute names
+      (required for SVGs)
@@ -87,4 +147,6 @@
-    - FEATURE: ipl has been aligned with the upcoming ipl-html library
-    - FEATURE: Director now supports multiple Databases, allows to switch 
between
-      them and to deploy different Config Packages. Other features based on 
this
-      combined with related documentation will follow.
+    - FEATURE: ipl has been aligned with the upcoming ipl-html 
+      library
+    - FEATURE: Director now supports multiple Databases, allows to 
+      switch between them and to deploy different Config Packages. 
+      Other features based on this combined with related 
+      documentation will follow.
@@ -158 +220,2 @@
-    - Icinga Director now requires PHP 5.4, support for 5.3 has been dropped
+    - Icinga Director now requires PHP 5.4, support for 5.3 has 
++++ 165 more lines (skipped)
++++ between 
/work/SRC/openSUSE:Factory/icingaweb2-module-director/icingaweb2-module-director.changes
++++ and 
/work/SRC/openSUSE:Factory/.icingaweb2-module-director.new/icingaweb2-module-director.changes

Old:
----
  v1.5.1.tar.gz

New:
----
  v1.5.2.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ icingaweb2-module-director.spec ++++++
--- /var/tmp/diff_new_pack.OnulzO/_old  2018-11-10 17:00:57.667637474 +0100
+++ /var/tmp/diff_new_pack.OnulzO/_new  2018-11-10 17:00:57.667637474 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package icingaweb2-module-director
 #
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -19,10 +19,10 @@
 # See also http://en.opensuse.org/openSUSE:Specfile_guidelines
 
 Name:           icingaweb2-module-director
-Version:        1.5.1
+Version:        1.5.2
 Release:        0
 Summary:        Config module for Icinga Web 2
-License:        GPL-2.0+
+License:        GPL-2.0-or-later
 Group:          System/Monitoring
 Url:            https://www.icinga.org
 Source0:        https://github.com/Icinga/%{name}/archive/v%{version}.tar.gz

++++++ v1.5.1.tar.gz -> v1.5.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/icingaweb2-module-director-1.5.1/doc/82-Changelog.md 
new/icingaweb2-module-director-1.5.2/doc/82-Changelog.md
--- old/icingaweb2-module-director-1.5.1/doc/82-Changelog.md    2018-08-14 
10:12:03.000000000 +0200
+++ new/icingaweb2-module-director-1.5.2/doc/82-Changelog.md    2018-10-30 
17:28:29.000000000 +0100
@@ -4,6 +4,26 @@
 Please make sure to always read our [Upgrading](05-Upgrading.md) documentation
 before switching to a new version.
 
+1.5.2
+-----
+### Fixed issues
+* You can find issues and feature requests related to this release on our
+  
[roadmap](https://github.com/Icinga/icingaweb2-module-director/milestone/17?closed=1)
+
+### Configuration rendering
+* FIX: Fix compatibility with Icinga v2.6, got broken with v1.5.0 (#1614)
+
+### REST API
+* FIX: No more invalid JSON in some special circumstances (#1314)
+
+### User Interface
+* FIX: Hostgroup assignment cache has been fixed (#1574, #1618)
+
+### DB Schema
+* FIX: missing user/timeperiod constraint. We usually do not touch the schema
+  in minor versions, this has been cherry-picked by accident. However, don't
+  worry - the migration has been tested intensively.
+
 1.5.1
 -----
 ### Fixed issues
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/icingaweb2-module-director-1.5.1/library/Director/IcingaConfig/IcingaConfig.php
 
new/icingaweb2-module-director-1.5.2/library/Director/IcingaConfig/IcingaConfig.php
--- 
old/icingaweb2-module-director-1.5.1/library/Director/IcingaConfig/IcingaConfig.php
 2018-08-14 10:12:03.000000000 +0200
+++ 
new/icingaweb2-module-director-1.5.2/library/Director/IcingaConfig/IcingaConfig.php
 2018-10-30 17:28:29.000000000 +0100
@@ -554,14 +554,12 @@
      * Seems that host is missing when used in a service object, works fine for
      * apply rules
      */
-    try {
-      if (! host) {
-        var host = get_host(host_name)
-      }
-      if (! host) {
-        globals.directorWarnOnceForServiceWithoutHost()
-      }
-    } except { globals.directorWarnOnceForServiceWithoutHost() }
+    if (! host) {
+      var host = get_host(host_name)
+    }
+    if (! host) {
+      globals.directorWarnOnceForServiceWithoutHost()
+    }
 
     if (vars) {
       vars += host.vars[DirectorOverrideVars][name]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/icingaweb2-module-director-1.5.1/library/Director/Objects/GroupMembershipResolver.php
 
new/icingaweb2-module-director-1.5.2/library/Director/Objects/GroupMembershipResolver.php
--- 
old/icingaweb2-module-director-1.5.1/library/Director/Objects/GroupMembershipResolver.php
   2018-08-14 10:12:03.000000000 +0200
+++ 
new/icingaweb2-module-director-1.5.2/library/Director/Objects/GroupMembershipResolver.php
   2018-10-30 17:28:29.000000000 +0100
@@ -5,6 +5,8 @@
 use Icinga\Application\Benchmark;
 use Icinga\Data\Filter\Filter;
 use Icinga\Module\Director\Db;
+use Icinga\Module\Director\Db\IcingaObjectFilterHelper;
+use Icinga\Module\Director\Repository\IcingaTemplateRepository;
 use InvalidArgumentException;
 use LogicException;
 use Zend_Db_Select as ZfSelect;
@@ -39,6 +41,9 @@
     /** @var IcingaObjectGroup[] */
     protected $groups = array();
 
+    /** @var array */
+    protected $staticGroups = array();
+
     /** @var bool */
     protected $deferred = false;
 
@@ -70,10 +75,20 @@
     public function refreshDb($force = false)
     {
         if ($force || ! $this->isDeferred()) {
-            Benchmark::measure('Going to refresh all group mappings');
-            $this->fetchStoredMappings();
-            Benchmark::measure('Got stored HG mappings, rechecking all 
objects');
+            if ($this->isDeferred()) {
+                // ensure we are not working with cached data
+                IcingaTemplateRepository::clear();
+            }
+
+            Benchmark::measure('Rechecking all objects');
             $this->recheckAllObjects($this->getAppliedGroups());
+            if (empty($this->objects)) {
+                Benchmark::measure('Nothing to check, got no qualified 
object');
+
+                return $this;
+            }
+            Benchmark::measure('Recheck done, loading existing mappings');
+            $this->fetchStoredMappings();
             Benchmark::measure('Ready, going to store new mappings');
             $this->storeNewMappings();
             $this->removeOutdatedMappings();
@@ -140,7 +155,12 @@
             $this->objects = [];
         }
 
-        $this->objects[$id] = $object;
+        if ($object->isTemplate()) {
+            $this->includeChildObjects($object);
+        } else {
+            $this->objects[$id] = $object;
+        }
+
         return $this;
     }
 
@@ -157,6 +177,26 @@
         return $this;
     }
 
+    protected function includeChildObjects(IcingaObject $object)
+    {
+        $query = $this->db->select()
+            ->from(['o' => $object->getTableName()])
+            ->where('o.object_type = ?', 'object');
+
+        IcingaObjectFilterHelper::filterByTemplate(
+            $query,
+            $object,
+            'o',
+            Db\IcingaObjectFilterHelper::INHERIT_DIRECT_OR_INDIRECT
+        );
+
+        foreach ($object::loadAll($this->connection, $query) as $child) {
+            $this->objects[$child->getProperty('id')] = $child;
+        }
+
+        return $this;
+    }
+
     /**
      * @param IcingaObject $object
      * @return $this
@@ -193,10 +233,7 @@
     public function addGroup(IcingaObjectGroup $group)
     {
         $this->assertBeenLoadedFromDb($group);
-
-        if ($group->get('assign_filter') !== null) {
-            $this->groups[$group->get('id')] = $group;
-        }
+        $this->groups[$group->get('id')] = $group;
 
         return $this;
     }
@@ -364,8 +401,14 @@
                 'object_id' => "${type}_id",
             )
         );
+
         $this->addMembershipWhere($query, "${type}_id", $this->objects);
         $this->addMembershipWhere($query, "${type}group_id", $this->groups);
+        if (! empty($this->groups)) {
+            // load staticGroups (we touched here) additionally, so we can 
compare changes
+            $this->addMembershipWhere($query, "${type}group_id", 
$this->staticGroups);
+        }
+
         foreach ($this->db->fetchAll($query) as $row) {
             $groupId = $row->group_id;
             $objectId = $row->object_id;
@@ -382,7 +425,7 @@
     /**
      * @param ZfSelect $query
      * @param string $column
-     * @param IcingaObject[] $objects
+     * @param IcingaObject[]|int[] $objects
      * @return ZfSelect
      */
     protected function addMembershipWhere(ZfSelect $query, $column, & $objects)
@@ -392,8 +435,14 @@
         }
 
         $ids = array();
-        foreach ($objects as $object) {
-            $ids[] = (int) $object->get('id');
+        foreach ($objects as $k => $object) {
+            if (is_int($object)) {
+                $ids[] = $k;
+            } elseif (is_string($object)) {
+                $ids[] = (int) $object;
+            } else {
+                $ids[] = (int) $object->get('id');
+            }
         }
 
         if (count($ids) === 1) {
@@ -407,7 +456,8 @@
 
     protected function recheckAllObjects($groups)
     {
-        $mappings = array();
+        $mappings = [];
+        $staticGroups = [];
 
         if ($this->objects === null) {
             $objects = $this->fetchAllObjects();
@@ -424,6 +474,7 @@
             if ($object->isTemplate()) {
                 continue;
             }
+
             $mt = microtime(true);
             $id = $object->get('id');
 
@@ -439,7 +490,7 @@
                 }
             }
 
-
+            // can only be run reliably when updating for all groups
             $groupNames = $object->get('groups');
             if (empty($groupNames)) {
                 $groupNames = $object->listInheritedGroupNames();
@@ -451,6 +502,7 @@
                 }
 
                 $mappings[$groupId][$id] = $id;
+                $staticGroups[$groupId] = $groupId;
             }
 
             $times[] = (microtime(true) - $mt) * 1000;
@@ -473,13 +525,10 @@
             $avg
         ));
 
-        foreach ($this->fetchMissingSingleAssignments() as $row) {
-            $mappings[$row->group_id][$row->object_id] = $row->object_id;
-        }
-
         Benchmark::measure('Done with single assignments');
 
         $this->newMappings = $mappings;
+        $this->staticGroups = $staticGroups;
     }
 
     protected function getAppliedGroups()
@@ -510,7 +559,7 @@
                 'id',
                 'assign_filter',
             )
-        )->where('assign_filter IS NOT NULL');
+        )->where("assign_filter IS NOT NULL AND assign_filter != ''");
 
         return $this->parseFilters($this->db->fetchPairs($query));
     }
@@ -529,30 +578,6 @@
         }, $list);
     }
 
-    protected function fetchMissingSingleAssignments()
-    {
-        $type = $this->getType();
-        $query = $this->db->select()->from(
-            array("go" => $this->getTableName()),
-            array(
-                'object_id' => "${type}_id",
-                'group_id'  => "${type}group_id",
-            )
-        )->joinLeft(
-            array("gor" => $this->getResolvedTableName()),
-            "go.${type}_id = gor.${type}_id AND go.${type}group_id = 
gor.${type}group_id",
-            array()
-        );
-
-        $this->addMembershipWhere($query, "go.${type}_id", $this->objects);
-        $this->addMembershipWhere($query, "go.${type}group_id", $this->groups);
-
-        // Order matters, this must be AND:
-        $query->where("gor.${type}_id IS NULL");
-
-        return $this->db->fetchAll($query);
-    }
-
     protected function getTableName()
     {
         $type = $this->getType();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/icingaweb2-module-director-1.5.1/library/Director/Objects/IcingaObject.php 
new/icingaweb2-module-director-1.5.2/library/Director/Objects/IcingaObject.php
--- 
old/icingaweb2-module-director-1.5.1/library/Director/Objects/IcingaObject.php  
    2018-08-14 10:12:03.000000000 +0200
+++ 
new/icingaweb2-module-director-1.5.2/library/Director/Objects/IcingaObject.php  
    2018-10-30 17:28:29.000000000 +0100
@@ -888,7 +888,8 @@
     {
         $this->assertImportsSupport();
         if ($this->imports === null) {
-            if ($this->hasBeenLoadedFromDb()) {
+            // can not use hasBeenLoadedFromDb() when in onStore()
+            if ($this->getProperty('id') !== null) {
                 $this->imports = 
IcingaObjectImports::loadForStoredObject($this);
             } else {
                 $this->imports = new IcingaObjectImports($this);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/icingaweb2-module-director-1.5.1/library/Director/Objects/ObjectApplyMatches.php
 
new/icingaweb2-module-director-1.5.2/library/Director/Objects/ObjectApplyMatches.php
--- 
old/icingaweb2-module-director-1.5.1/library/Director/Objects/ObjectApplyMatches.php
        2018-08-14 10:12:03.000000000 +0200
+++ 
new/icingaweb2-module-director-1.5.2/library/Director/Objects/ObjectApplyMatches.php
        2018-10-30 17:28:29.000000000 +0100
@@ -52,7 +52,12 @@
 
     public function matchesFilter(Filter $filter)
     {
-        return static::getPreparedFilter($filter)->matches($this->flatObject);
+        $filterObj = static::getPreparedFilter($filter);
+        if ($filterObj->isExpression() || ! $filterObj->isEmpty()) {
+            return $filterObj->matches($this->flatObject);
+        } else {
+            return false;
+        }
     }
 
     /**
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/icingaweb2-module-director-1.5.1/library/Director/Repository/IcingaTemplateRepository.php
 
new/icingaweb2-module-director-1.5.2/library/Director/Repository/IcingaTemplateRepository.php
--- 
old/icingaweb2-module-director-1.5.1/library/Director/Repository/IcingaTemplateRepository.php
       2018-08-14 10:12:03.000000000 +0200
+++ 
new/icingaweb2-module-director-1.5.2/library/Director/Repository/IcingaTemplateRepository.php
       2018-10-30 17:28:29.000000000 +0100
@@ -114,4 +114,9 @@
 
         return $db->fetchCol($query);
     }
+
+    public static function clear()
+    {
+        static::clearInstances();
+    }
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/icingaweb2-module-director-1.5.1/library/Director/Repository/RepositoryByObjectHelper.php
 
new/icingaweb2-module-director-1.5.2/library/Director/Repository/RepositoryByObjectHelper.php
--- 
old/icingaweb2-module-director-1.5.1/library/Director/Repository/RepositoryByObjectHelper.php
       2018-08-14 10:12:03.000000000 +0200
+++ 
new/icingaweb2-module-director-1.5.2/library/Director/Repository/RepositoryByObjectHelper.php
       2018-10-30 17:28:29.000000000 +0100
@@ -91,4 +91,9 @@
 
         return self::$auth;
     }
+
+    protected static function clearInstances()
+    {
+        self::$instances = [];
+    }
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/icingaweb2-module-director-1.5.1/library/Director/Resolver/TemplateTree.php 
new/icingaweb2-module-director-1.5.2/library/Director/Resolver/TemplateTree.php
--- 
old/icingaweb2-module-director-1.5.1/library/Director/Resolver/TemplateTree.php 
    2018-08-14 10:12:03.000000000 +0200
+++ 
new/icingaweb2-module-director-1.5.2/library/Director/Resolver/TemplateTree.php 
    2018-10-30 17:28:29.000000000 +0100
@@ -121,7 +121,9 @@
 
     public function getParentsFor(IcingaObject $object)
     {
-        if ($object->hasBeenLoadedFromDb()) {
+        // can not use hasBeenLoadedFromDb() when in onStore()
+        $id = $object->getProperty('id');
+        if ($id !== null) {
             return $this->getParentsById($object->getProperty('id'));
         } else {
             throw new RuntimeException(
@@ -223,8 +225,10 @@
 
     public function getChildrenFor(IcingaObject $object)
     {
-        if ($object->hasBeenLoadedFromDb()) {
-            return $this->getChildrenById($object->getProperty('id'));
+        // can not use hasBeenLoadedFromDb() when in onStore()
+        $id = $object->getProperty('id');
+        if ($id !== null) {
+            return $this->getChildrenById($id);
         } else {
             throw new RuntimeException(
                 'Loading children for unstored objects has not been 
implemented yet'
@@ -246,8 +250,10 @@
 
     public function getDescendantsFor(IcingaObject $object)
     {
-        if ($object->hasBeenLoadedFromDb()) {
-            return $this->getDescendantsById($object->getProperty('id'));
+        // can not use hasBeenLoadedFromDb() when in onStore()
+        $id = $object->getProperty('id');
+        if ($id !== null) {
+            return $this->getDescendantsById($id);
         } else {
             throw new RuntimeException(
                 'Loading descendants for unstored objects has not been 
implemented yet'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/icingaweb2-module-director-1.5.1/library/Director/Web/Controller/ObjectController.php
 
new/icingaweb2-module-director-1.5.2/library/Director/Web/Controller/ObjectController.php
--- 
old/icingaweb2-module-director-1.5.1/library/Director/Web/Controller/ObjectController.php
   2018-08-14 10:12:03.000000000 +0200
+++ 
new/icingaweb2-module-director-1.5.2/library/Director/Web/Controller/ObjectController.php
   2018-10-30 17:28:29.000000000 +0100
@@ -59,6 +59,12 @@
                 $handler->setObject($this->object);
             }
             $handler->dispatch();
+            // Hint: also here, hard exit. There is too much magic going on.
+            // Letting this bubble up smoothly would be "correct", but proved
+            // to be too fragile. Web 2, all kinds of pre/postDispatch magic,
+            // different view renderers - hard exit is the only safe bet right
+            // now.
+            exit;
         } else {
             $this->eventuallyLoadObject();
             if ($this->getRequest()->getActionName() === 'add') {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/icingaweb2-module-director-1.5.1/module.info 
new/icingaweb2-module-director-1.5.2/module.info
--- old/icingaweb2-module-director-1.5.1/module.info    2018-08-14 
10:12:03.000000000 +0200
+++ new/icingaweb2-module-director-1.5.2/module.info    2018-10-30 
17:28:29.000000000 +0100
@@ -1,5 +1,5 @@
 Name: Icinga Director
-Version: 1.5.1
+Version: 1.5.2
 Depends: monitoring
 Description: Director - Config tool for Icinga 2
  Icinga Director is a configuration tool that has been designed to make
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/icingaweb2-module-director-1.5.1/schema/mysql-migrations/upgrade_150.sql 
new/icingaweb2-module-director-1.5.2/schema/mysql-migrations/upgrade_150.sql
--- 
old/icingaweb2-module-director-1.5.1/schema/mysql-migrations/upgrade_150.sql    
    1970-01-01 01:00:00.000000000 +0100
+++ 
new/icingaweb2-module-director-1.5.2/schema/mysql-migrations/upgrade_150.sql    
    2018-10-30 17:28:29.000000000 +0100
@@ -0,0 +1,17 @@
+UPDATE icinga_user u
+SET period_id = NULL
+WHERE NOT EXISTS (
+  SELECT id FROM icinga_timeperiod
+  WHERE id = u.period_id
+) AND u.period_id IS NOT NULL;
+
+ALTER TABLE icinga_user
+  ADD CONSTRAINT icinga_user_period
+  FOREIGN KEY period (period_id)
+  REFERENCES icinga_timeperiod (id)
+    ON DELETE RESTRICT
+    ON UPDATE CASCADE;
+
+INSERT INTO director_schema_migration
+  (schema_version, migration_time)
+  VALUES (150, NOW());
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/icingaweb2-module-director-1.5.1/schema/mysql.sql 
new/icingaweb2-module-director-1.5.2/schema/mysql.sql
--- old/icingaweb2-module-director-1.5.1/schema/mysql.sql       2018-08-14 
10:12:03.000000000 +0200
+++ new/icingaweb2-module-director-1.5.2/schema/mysql.sql       2018-10-30 
17:28:29.000000000 +0100
@@ -940,6 +940,11 @@
     FOREIGN KEY zone (zone_id)
     REFERENCES icinga_zone (id)
     ON DELETE RESTRICT
+    ON UPDATE CASCADE,
+  CONSTRAINT icinga_user_period
+    FOREIGN KEY period (period_id)
+    REFERENCES icinga_timeperiod (id)
+    ON DELETE RESTRICT
     ON UPDATE CASCADE
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
@@ -1692,4 +1697,4 @@
 
 INSERT INTO director_schema_migration
   (schema_version, migration_time)
-  VALUES (149, NOW());
+  VALUES (150, NOW());
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/icingaweb2-module-director-1.5.1/schema/pgsql-migrations/upgrade_150.sql 
new/icingaweb2-module-director-1.5.2/schema/pgsql-migrations/upgrade_150.sql
--- 
old/icingaweb2-module-director-1.5.1/schema/pgsql-migrations/upgrade_150.sql    
    1970-01-01 01:00:00.000000000 +0100
+++ 
new/icingaweb2-module-director-1.5.2/schema/pgsql-migrations/upgrade_150.sql    
    2018-10-30 17:28:29.000000000 +0100
@@ -0,0 +1,17 @@
+UPDATE icinga_user u
+SET period_id = NULL
+WHERE NOT EXISTS (
+  SELECT id FROM icinga_timeperiod
+  WHERE id = u.period_id
+) AND u.period_id IS NOT NULL;
+
+ALTER TABLE icinga_user
+  ADD CONSTRAINT icinga_user_period
+  FOREIGN KEY (period_id)
+  REFERENCES icinga_timeperiod (id)
+    ON DELETE RESTRICT
+    ON UPDATE CASCADE;
+
+INSERT INTO director_schema_migration
+  (schema_version, migration_time)
+  VALUES (150, NOW());
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/icingaweb2-module-director-1.5.1/schema/pgsql.sql 
new/icingaweb2-module-director-1.5.2/schema/pgsql.sql
--- old/icingaweb2-module-director-1.5.1/schema/pgsql.sql       2018-08-14 
10:12:03.000000000 +0200
+++ new/icingaweb2-module-director-1.5.2/schema/pgsql.sql       2018-10-30 
17:28:29.000000000 +0100
@@ -1157,6 +1157,11 @@
   FOREIGN KEY (zone_id)
     REFERENCES icinga_zone (id)
     ON DELETE RESTRICT
+    ON UPDATE CASCADE,
+  CONSTRAINT icinga_user_period
+  FOREIGN KEY (period_id)
+    REFERENCES icinga_timeperiod (id)
+    ON DELETE RESTRICT
     ON UPDATE CASCADE
 );
 
@@ -1988,4 +1993,4 @@
 
 INSERT INTO director_schema_migration
   (schema_version, migration_time)
-  VALUES (149, NOW());
+  VALUES (150, NOW());


Reply via email to