summaryrefslogtreecommitdiffstats
path: root/install/ui/field.js
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2011-11-29 13:36:07 +0100
committerEndi S. Dewata <edewata@redhat.com>2011-12-05 16:01:44 +0000
commitab667912cf19d17e749d13b1d9f428ab6ae55b93 (patch)
tree2b00e180d2830a6bd673b83179141a6f355e3c17 /install/ui/field.js
parentfdee0892f12c98f5d03396c0d70e73d69b1a5ada (diff)
downloadfreeipa-ab667912cf19d17e749d13b1d9f428ab6ae55b93.tar.gz
freeipa-ab667912cf19d17e749d13b1d9f428ab6ae55b93.tar.xz
freeipa-ab667912cf19d17e749d13b1d9f428ab6ae55b93.zip
Code cleanup of HBAC, Sudo rules
https://fedorahosted.org/freeipa/ticket/1515
Diffstat (limited to 'install/ui/field.js')
-rw-r--r--install/ui/field.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/install/ui/field.js b/install/ui/field.js
index 850afceeb..2cba87864 100644
--- a/install/ui/field.js
+++ b/install/ui/field.js
@@ -577,6 +577,44 @@ IPA.link_field = function(spec) {
return that;
};
+IPA.enable_field = function(spec) {
+
+ spec = spec || {};
+
+ var that = IPA.radio_field(spec);
+
+ that.enable_method = spec.enable_method || 'enable';
+ that.disable_method = spec.enable_method || 'disable';
+ that.enable_option = spec.enable_option || 'TRUE';
+
+ that.get_update_info = function() {
+
+ var info = IPA.update_info_builder.new_update_info();
+ if(that.test_dirty()) {
+ var values = that.save();
+ var method = that.disable_method;
+
+ if(values[0] === that.enable_option) {
+ method = that.enable_method;
+ }
+
+ var command = IPA.command({
+ entity: that.entity.name,
+ method: method,
+ args: that.entity.get_primary_key(),
+ options: {all: true, rights: true}
+ });
+
+
+ info.append_command(command, that.priority);
+ }
+
+ return info;
+ };
+
+ return that;
+};
+
IPA.field_container = function(spec) {
spec = spec || {};
@@ -686,3 +724,4 @@ IPA.field_factories['textarea'] = IPA.field;
IPA.field_factories['entity_select'] = IPA.combobox_field;
IPA.field_factories['combobox'] = IPA.combobox_field;
IPA.field_factories['link'] = IPA.link_field;
+IPA.field_factories['enable'] = IPA.enable_field;