[icinga-checkins] icinga.org: icinga-web/feature/datapermissions-wip: Updated CustomVariable Credential

git at icinga.org git at icinga.org
Tue Feb 19 17:23:59 CET 2013


Module: icinga-web
Branch: feature/datapermissions-wip
Commit: 4e8f03102feaf6326147323c732615081307bc59
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=4e8f03102feaf6326147323c732615081307bc59

Author: Markus Frosch <markus at lazyfrosch.de>
Date:   Tue Feb 19 15:07:17 2013 +0100

Updated CustomVariable Credential

* multiple CVs aggregated by OR
* LIKE wildcards

---

 .../Extender/CustomVariableExtenderModel.class.php |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/app/modules/Api/models/Views/Extender/CustomVariableExtenderModel.class.php b/app/modules/Api/models/Views/Extender/CustomVariableExtenderModel.class.php
index 5e52124..9fb4fb3 100644
--- a/app/modules/Api/models/Views/Extender/CustomVariableExtenderModel.class.php
+++ b/app/modules/Api/models/Views/Extender/CustomVariableExtenderModel.class.php
@@ -66,11 +66,11 @@ class Api_Views_Extender_CustomVariableExtenderModel extends IcingaBaseModel
             "cv_name" => "varname",
             "cv_value" => "varvalue"
         );
+        $pairs = array();
         foreach($targetVals as $cvKeyValuePair) {
-            $query->andWhere(
-                "($aliasAbbr.".$keymap[$cvKeyValuePair["tv_key"]]." = '".$cvKeyValuePair["tv_val"]."'
-                    $objectTypeClause  ".$whereAppendix.")"
-            );
+            $pairs[] = "($aliasAbbr.".$keymap[$cvKeyValuePair["tv_key"]]." LIKE '".$cvKeyValuePair["tv_val"]."'
+                        $objectTypeClause  ".$whereAppendix.")";
         }
+        $query->andWhere(join(" OR ", $pairs));
     }
 }





More information about the icinga-checkins mailing list