summaryrefslogtreecommitdiffstats
path: root/install/static/ipa.js
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2010-11-04 21:42:37 -0500
committerAdam Young <ayoung@redhat.com>2010-11-08 20:06:49 -0500
commitc854435a27e0595c17661e80d38d5fa0016f8c96 (patch)
tree345245bcbbdf10fe29fca565581b6bd2aedd8822 /install/static/ipa.js
parent537f4074d1606e9608773868ea630ca58effa61f (diff)
downloadfreeipa-c854435a27e0595c17661e80d38d5fa0016f8c96.tar.gz
freeipa-c854435a27e0595c17661e80d38d5fa0016f8c96.tar.xz
freeipa-c854435a27e0595c17661e80d38d5fa0016f8c96.zip
HBAC Access Time
IPA commands now can be defined in these classes: - ipa_command: a single IPA command - ipa_batch_command: a batch command for executing multiple commands on the server side using the new batch plugin The dialog boxes for adding and removing entries have been refactored: - ipa_dialog: base class for dialog boxes - ipa_adder_dialog: generic adder dialog box - ipa_deleter_dialog: generic deleter dialog box - ipa_association_adder_dialog: adding entity association - ipa_association_deleter_dialog: removing entity association Dialog boxes for adding/deleting HBAC users, hosts, services, and sourcehosts are implemented using the association dialog boxes. The dialog box for adding access time is implemented using ipa_dialog and currently contains only a text field. This will be replaced with a custom dialog box in a separate patch. The dialog box for removing access time is implemented using the generic deleter class because it's not an association. Removing multiple access times is implemented using batch operations. New test data files for access times have been added.
Diffstat (limited to 'install/static/ipa.js')
-rw-r--r--install/static/ipa.js75
1 files changed, 75 insertions, 0 deletions
diff --git a/install/static/ipa.js b/install/static/ipa.js
index 2cf858f89..f7fd90500 100644
--- a/install/static/ipa.js
+++ b/install/static/ipa.js
@@ -108,6 +108,81 @@ var IPA = ( function () {
return that;
}());
+function ipa_command(spec) {
+
+ spec = spec || {};
+
+ var that = {};
+ that.method = spec.method;
+
+ that.params = spec.params || [];
+ that.params[0] = spec.args || [];
+ that.params[1] = spec.options || {};
+
+ that.add_arg = function(arg) {
+ that.params[0].push(arg);
+ };
+
+ that.get_args = function() {
+ return that.params[0];
+ };
+
+ that.set_option = function(name, value) {
+ that.params[1][name] = value;
+ };
+
+ that.get_option = function(name) {
+ return that.params[1][name];
+ };
+
+ that.get_options = function() {
+ return that.params[1];
+ };
+
+ that.execute = function(on_success, on_error) {
+ ipa_cmd(
+ that.method,
+ that.get_args(),
+ that.get_options(),
+ on_success,
+ on_error
+ );
+ };
+
+ that.to_string = function() {
+ var string = that.method.replace(/_/g, '-');
+
+ var args = that.get_args();
+ for (var i=0; i<args.length; i++) {
+ string += ' '+args[i];
+ }
+
+ var options = that.get_options();
+ for (var name in options) {
+ string += ' --'+name+'=\''+options[name]+'\'';
+ }
+
+ return string;
+ };
+
+ return that;
+}
+
+function ipa_batch_command(spec) {
+
+ spec = spec || {};
+
+ spec.method = 'batch';
+
+ var that = ipa_command(spec);
+
+ that.add_command = function(command) {
+ that.add_arg(command);
+ };
+
+ return that;
+}
+
/* call an IPA command over JSON-RPC
* arguments:
* name - name of the command or method if objname is set