[icinga-checkins] icinga.org: icinga-web/r1.8: Fixed wrong credentials being given when user without credentials is being created (fixes #3423)

git at icinga.org git at icinga.org
Mon Jan 14 11:15:14 CET 2013


Module: icinga-web
Branch: r1.8
Commit: 65962655b4d9badc807ae3d359f93125938cccd9
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=65962655b4d9badc807ae3d359f93125938cccd9

Author: Jannis Mosshammer <jannis.mosshammer at netways.de>
Date:   Wed Dec 19 14:17:21 2012 +0100

Fixed wrong credentials being given when user without credentials is being created (fixes #3423)

---

 app/modules/AppKit/lib/database/models/NsmUser.php |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/app/modules/AppKit/lib/database/models/NsmUser.php b/app/modules/AppKit/lib/database/models/NsmUser.php
index dfe42d5..d2ee9fb 100644
--- a/app/modules/AppKit/lib/database/models/NsmUser.php
+++ b/app/modules/AppKit/lib/database/models/NsmUser.php
@@ -469,8 +469,10 @@ class NsmUser extends BaseNsmUser {
      * @return Doctrine_Collection
      */
     public function getTargets($type=null,$userOnly = false) {
-
-        return $this->getTargetsQuery($type,$userOnly)->execute();
+        $principals = $userOnly ? $this->getUserPrincipalsList() : $this->getPrincipalsList();
+        if(empty($principals))
+            return array();
+        return $this->getTargetsQuery($type,$userOnly,$principals)->execute();
     }
 
     /**
@@ -479,8 +481,10 @@ class NsmUser extends BaseNsmUser {
      * @param string $type
      * @return Doctrine_Query
      */
-    protected function getTargetsQuery($type=null,$userOnly = false) {
-        $principals = $userOnly ? $this->getUserPrincipalsList() : $this->getPrincipalsList();
+    protected function getTargetsQuery($type=null,$userOnly = false,$principals = null) {
+        if($principals == null)
+            $principals = $userOnly ? $this->getUserPrincipalsList() : $this->getPrincipalsList();
+
         $q = AppKitDoctrineUtil::createQuery()
              ->select('t.*')
              ->distinct(true)





More information about the icinga-checkins mailing list