From 504fa6c786e661a77452132c77a06bfbf6796c5d Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Fri, 26 Apr 2013 13:24:26 +0200 Subject: Do not offer already added members in association dialogs when different casing https://fedorahosted.org/freeipa/ticket/3235 --- install/ui/src/freeipa/association.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/install/ui/src/freeipa/association.js b/install/ui/src/freeipa/association.js index a689de43c..d33ec8742 100644 --- a/install/ui/src/freeipa/association.js +++ b/install/ui/src/freeipa/association.js @@ -234,7 +234,8 @@ IPA.association_adder_dialog = function(spec) { var pkey_attr = that.other_entity.metadata.primary_key; - var selected = that.get_selected_values(); + var selected = that.normalize_values(that.get_selected_values()); + var exclude = that.normalize_values(that.exclude); var results = data.result; var same_entity = that.entity === that.other_entity; @@ -243,7 +244,8 @@ IPA.association_adder_dialog = function(spec) { var pkey = result[pkey_attr][0]; if (same_entity && pkey === that.pkey) continue; - if (that.exclude.indexOf(pkey) >= 0) continue; + pkey = that.normalize_values([pkey])[0]; + if (exclude.indexOf(pkey) >= 0) continue; if (selected.indexOf(pkey) >= 0) continue; that.add_available_value(result); @@ -285,6 +287,14 @@ IPA.association_adder_dialog = function(spec) { }).execute(); }; + that.normalize_values = function(values) { + var norm = []; + for (var i=0; i