Rule tables with external member has more than one column and therefore exclude parameter for adder dialog is not array of strings but array of objects. normalize_values function can't work with it and causes JS error.

This patch creates proper exclude array before passing it to adder dialog.

https://fedorahosted.org/freeipa/ticket/3711
--
Petr Vobornik
From 08812bd38dd931a1c17b7b283924bbbd29d51450 Mon Sep 17 00:00:00 2001
From: Petr Vobornik <pvobo...@redhat.com>
Date: Wed, 12 Jun 2013 16:01:26 +0200
Subject: [PATCH] Regression fix: rule table with ext. member support doesn't
 offer any items

There is a JS error.

Rule tables with external member has more than one column and therefore exclude parameter for adder dialog is not array of strings but array of objects. normalize_values function can't work with it and causes JS error.

This patch creates proper exclude array before passing it to adder dialog.

https://fedorahosted.org/freeipa/ticket/3711
---
 install/ui/src/freeipa/rule.js | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/install/ui/src/freeipa/rule.js b/install/ui/src/freeipa/rule.js
index 959aec462d1c1e36220d3569fe2e776a60ab2c11..c6d2cfa506cf18b5c14aa891f8144ddb3facaca3 100644
--- a/install/ui/src/freeipa/rule.js
+++ b/install/ui/src/freeipa/rule.js
@@ -149,14 +149,23 @@ IPA.rule_association_table_widget = function(spec) {
         title = title.replace('${primary_key}', pkey);
         title = title.replace('${other_entity}', other_entity_label);
 
+        var exclude = that.values;
+        if (that.external) {
+            exclude = [];
+            for (var i=0; i<that.values.length; i++) {
+                exclude.push(that.values[i][that.name]);
+            }
+        }
+
         return IPA.rule_association_adder_dialog({
             title: title,
             pkey: pkey,
+            param: that.name,
             other_entity: that.other_entity,
             attribute_member: that.attribute_member,
             entity: that.entity,
             external: that.external,
-            exclude: that.values
+            exclude: exclude
         });
     };
 
-- 
1.8.1.4

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to