From 6ae286a8f5ec7d1633ec733fbe116550bff7141a Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Wed, 22 Aug 2012 14:03:20 +0200 Subject: Permissions: select only applicable options on type change Problem: When a permission is edited, and Type switched, the attributes selected for previous Type are still selected, and update fails, if they are invalid for the new Type. But it should get deselected or not even listed if Type changes. Fix: When Type is changed, attribute list is refreshed and still applicable attributes are chosen. If Type is reverted back, previously chosen attributes are back as chosen. If attributes are extended outside Web UI by not listed attr, this attr is listed at the list end. Note: If user makes change in attribute list before type change, this change is forgotten. https://fedorahosted.org/freeipa/ticket/2617 --- install/ui/aci.js | 90 ++++++++++++++++++++++++++----------------------------- 1 file changed, 43 insertions(+), 47 deletions(-) (limited to 'install/ui') diff --git a/install/ui/aci.js b/install/ui/aci.js index 039e6332..bd7de19a 100644 --- a/install/ui/aci.js +++ b/install/ui/aci.js @@ -467,6 +467,7 @@ IPA.attributes_widget = function(spec) { var that = IPA.checkboxes_widget(spec); that.object_type = spec.object_type; + that.skip_unmatched = spec.skip_unmatched === undefined ? false : spec.skip_unmatched; var id = spec.name; @@ -512,6 +513,30 @@ IPA.attributes_widget = function(spec) { that.create_error_link(container); }; + that.create_options = function(options) { + var tbody = $('tbody', that.table); + + for (var i=0; i').appendTo(tbody); + + var td = $('').appendTo(tr); + td.append($('',{ + type: 'checkbox', + name: that.name, + value: value, + 'class': 'aci-attribute', + change: function() { + that.value_changed.notify([], that); + } + })); + td = $('').appendTo(tr); + td.append($('