[icinga-checkins] icinga.org: icinga-web/master: Fixed recognition of accounts without credentials

git at icinga.org git at icinga.org
Wed Aug 29 17:16:00 CEST 2012


Module: icinga-web
Branch: master
Commit: 51ece9982730ef29cd91b2a2d20a71506a2cbb83
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=51ece9982730ef29cd91b2a2d20a71506a2cbb83

Author: Jannis Moßhammer <jannis.mosshammer at netways.de>
Date:   Wed Aug 29 17:15:21 2012 +0200

Fixed recognition of accounts without credentials

---

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

diff --git a/app/modules/Api/models/Filter/UserObjectIdModel.class.php b/app/modules/Api/models/Filter/UserObjectIdModel.class.php
index 319d846..5390645 100755
--- a/app/modules/Api/models/Filter/UserObjectIdModel.class.php
+++ b/app/modules/Api/models/Filter/UserObjectIdModel.class.php
@@ -66,7 +66,7 @@ implements IcingaIDoctrineQueryFilter {
         
         if ($this->hasParameter('target_fields')) {
             $fields = $this->getParameter('target_fields');
-            
+
             if (is_string($fields)) {
                 $this->setFieldsAsString($fields);
             } elseif (is_array($fields)) {
@@ -153,8 +153,8 @@ implements IcingaIDoctrineQueryFilter {
      * @return boolean
      */
     public function canApply() {
-        AppKitLogger::verbose("Testing canApply: for %s objects and %s countfields",$this->countFields(),count($this->getObjectIds()));
-        if ($this->countFields() > 0) {
+        AppKitLogger::verbose("Testing canApply: for %s objects and %s countfields",$this->getObjectIds(),$this->countFields());
+        if ($this->countFields() > 0 && $this->getObjectIds() !== array("-1")) {
             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 25f864f..336f7f7 100755
--- a/app/modules/AppKit/models/Credential/AggregatorModel.class.php
+++ b/app/modules/AppKit/models/Credential/AggregatorModel.class.php
@@ -198,6 +198,7 @@ class AppKit_Credential_AggregatorModel extends AppKitBaseModel
         $targets = $this->user->getNsmUser()->getTargetValuesArray();
         
         $count = 0;
+        $hasCredentials = false;
         $this->context->getModel("DBALMetaManager","Api")->switchIcingaDatabase("icinga");
         foreach ($targets as $name=>$target) {
             if (count($target)>0 || $name === 'IcingaContactgroup') {
@@ -208,9 +209,12 @@ class AppKit_Credential_AggregatorModel extends AppKitBaseModel
                         $user_name, $name);
                 
                 $this->dispatchCollection($name, $target);
+                $hasCredentials = true;
             }
         }
-        
+        if(!$hasCredentials) {
+            $this->object_ids = array("-1" => true);
+        }
         $time_duration = microtime(true) - $time_start;
         
         AppKitLogger::verbose('Credentials (%s): Duration for %d types (%d oids): %.04fs',





More information about the icinga-checkins mailing list