[icinga-checkins] icinga.org: icinga-web/jmosshammer/filtering: Fixde credential aggregration when no credentials are given

git at icinga.org git at icinga.org
Wed Jan 2 15:43:54 CET 2013


Module: icinga-web
Branch: jmosshammer/filtering
Commit: ca1e42507103de18d49cc064dd47f71e62c73d72
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=ca1e42507103de18d49cc064dd47f71e62c73d72

Author: Jannis Mosshammer <jannis.mosshammer at netways.de>
Date:   Tue Dec 18 12:23:02 2012 +0100

Fixde credential aggregration when no credentials are given

---

 .../Api/models/Filter/UserObjectIdModel.class.php  |    5 +++--
 .../models/Credential/AggregatorModel.class.php    |    3 +++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/app/modules/Api/models/Filter/UserObjectIdModel.class.php b/app/modules/Api/models/Filter/UserObjectIdModel.class.php
index 5390645..4ae92d7 100755
--- a/app/modules/Api/models/Filter/UserObjectIdModel.class.php
+++ b/app/modules/Api/models/Filter/UserObjectIdModel.class.php
@@ -93,7 +93,7 @@ implements IcingaIDoctrineQueryFilter {
     public function postQuery(Doctrine_Query_Abstract $query) {
         if ($this->canApply() === true) {
             if(count($this->getObjectIds()) < 1) {
-                $query->andWhere("1 = 2"); 
+                $query->andWhere("1 = 2");
                  AppKitLogger::verbose("Query is now : %s ",$query->getSqlQuery());
             } else {
                 $binds = $this->getObjectIds();
@@ -154,7 +154,8 @@ implements IcingaIDoctrineQueryFilter {
      */
     public function canApply() {
         AppKitLogger::verbose("Testing canApply: for %s objects and %s countfields",$this->getObjectIds(),$this->countFields());
-        if ($this->countFields() > 0 && $this->getObjectIds() !== array("-1")) {
+
+        if ($this->countFields() > 0 && !in_array("-1",$this->getObjectIds())) {
             AppKitLogger::verbose("Extender can be applied on this query");
             return true;
         }
diff --git a/app/modules/AppKit/models/Credential/AggregatorModel.class.php b/app/modules/AppKit/models/Credential/AggregatorModel.class.php
index 296d75b..eb1667f 100755
--- a/app/modules/AppKit/models/Credential/AggregatorModel.class.php
+++ b/app/modules/AppKit/models/Credential/AggregatorModel.class.php
@@ -125,6 +125,9 @@ class AppKit_Credential_AggregatorModel extends AppKitBaseModel
         $storage = $this->getContext()->getStorage();
         $oids = $storage->read(self::SESSION_KEY_OID);
         $this->object_ids = array_flip(unpack("I*",$oids));
+        if(isset($this->object_ids["-1"])) {
+            $this->object_ids = array("-1"=>"0");
+        }
         $username = $this->user->getNsmUser()->user_name;
         
         AppKitLogger::verbose('Credentials (%s): Read cache, %d objects', 





More information about the icinga-checkins mailing list