summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2011-07-19 11:11:36 -0500
committerAdam Young <ayoung@redhat.com>2011-07-20 15:09:19 -0400
commit8e8ad513a73f8f08e2cfac1914ee0950b66f7866 (patch)
tree1355808ebd868fd7b7632fd6921f883461856a3e
parent6d14331a0561e98e4ce8a51bb418c1f6d25b5e88 (diff)
downloadfreeipa-8e8ad513a73f8f08e2cfac1914ee0950b66f7866.tar.gz
freeipa-8e8ad513a73f8f08e2cfac1914ee0950b66f7866.tar.xz
freeipa-8e8ad513a73f8f08e2cfac1914ee0950b66f7866.zip
Creating reverse zones from IP address.
A custom adder dialog has been added for DNS zones to simplify creating reverse zones from IP address. The dialog provides a checkbox which indicates whether the content of the zone name field is an IP address. The IP address will be used to generate the reverse zone name and email address. Ticket #1045
-rw-r--r--install/ui/dns.js142
-rw-r--r--install/ui/test/data/ipa_init.json55
2 files changed, 181 insertions, 16 deletions
diff --git a/install/ui/dns.js b/install/ui/dns.js
index 58aeaddff..f01d2bb9c 100644
--- a/install/ui/dns.js
+++ b/install/ui/dns.js
@@ -80,15 +80,155 @@ IPA.entity_factories.dnszone = function() {
}).
standard_association_facets().
adder_dialog({
+ factory: IPA.dnszone_adder_dialog,
+ width: 500,
+ height: 300,
fields: [
'idnsname',
+ {
+ factory: IPA.checkbox_widget,
+ name: 'name_from_ip',
+ undo: false
+ },
'idnssoamname',
'idnssoarname',
- {factory:IPA.force_dnszone_add_checkbox_widget}]
+ {
+ factory: IPA.force_dnszone_add_checkbox_widget
+ }
+ ]
}).
build();
};
+IPA.dnszone_adder_dialog = function(spec) {
+
+ spec = spec || {};
+
+ var that = IPA.add_dialog(spec);
+
+ that.create = function() {
+
+ var table = $('<table/>').appendTo(that.container);
+
+ var field = that.fields.get('idnsname');
+ var tr = $('<tr/>').appendTo(table);
+
+ var td = $('<td/>', {
+ style: 'vertical-align: top;',
+ title: field.label
+ }).appendTo(tr);
+
+ td.append($('<label/>', {
+ text: field.label+':'
+ }));
+
+ td = $('<td/>', {
+ style: 'vertical-align: top;'
+ }).appendTo(tr);
+
+ var span = $('<span/>', {
+ name: field.name
+ }).appendTo(td);
+
+ field.create(span);
+ field.field_span = span;
+
+ field = that.fields.get('name_from_ip');
+ tr = $('<tr/>').appendTo(table);
+
+ td = $('<td/>', {
+ style: 'vertical-align: top;',
+ title: field.label
+ }).appendTo(tr);
+
+ td = $('<td/>', {
+ style: 'vertical-align: top;'
+ }).appendTo(tr);
+
+ span = $('<span/>', {
+ name: field.name
+ }).appendTo(td);
+
+ td.append($('<label/>', {
+ text: field.label
+ }));
+
+ field.create(span);
+ field.field_span = span;
+
+ tr = $('<tr/>').appendTo(table);
+
+ td = $('<td/>', {
+ colspan: 2,
+ html: '&nbsp;'
+ }).appendTo(tr);
+
+ var fields = that.fields.values;
+ for (var i=0; i<fields.length; i++) {
+ field = fields[i];
+ if (field.name == 'idnsname' || field.name == 'name_from_ip') continue;
+ if (field.hidden) continue;
+
+ tr = $('<tr/>').appendTo(table);
+
+ td = $('<td/>', {
+ style: 'vertical-align: top;',
+ title: field.label
+ }).appendTo(tr);
+
+ td.append($('<label/>', {
+ text: field.label+':'
+ }));
+
+ td = $('<td/>', {
+ style: 'vertical-align: top;'
+ }).appendTo(tr);
+
+ span = $('<span/>', {
+ name: field.name
+ }).appendTo(td);
+
+ field.create(span);
+ field.field_span = span;
+ }
+ };
+
+ that.save = function(record) {
+
+ var idnsname;
+ var name_from_ip;
+
+ var fields = that.fields.values;
+ for (var i=0; i<fields.length; i++) {
+ var field = fields[i];
+
+ if (field.name == 'idnsname') {
+
+ idnsname = field.save()[0];
+
+ } else if (field.name == 'name_from_ip') {
+
+ name_from_ip = field.save()[0];
+ if (name_from_ip) {
+ record.name_from_ip = idnsname;
+ } else {
+ record.idnsname = idnsname;
+ }
+
+ } else if (field.name == 'idnssoarname') {
+
+ field.optional = name_from_ip;
+
+ } else {
+ var values = field.save();
+ record[field.name] = values.join(',');
+ }
+ }
+ };
+
+ return that;
+};
+
IPA.dns_record_search_load = function (result) {
this.table.empty();
var normalized_record;
diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json
index 6277e39c4..7d9d234e9 100644
--- a/install/ui/test/data/ipa_init.json
+++ b/install/ui/test/data/ipa_init.json
@@ -2549,7 +2549,7 @@
"cli_name": "ipaentitlementid",
"cli_short_name": null,
"default": null,
- "doc": "Enrollment UUID",
+ "doc": "Enrollment UUID (not implemented)",
"exclude": null,
"flags": [
"no_update",
@@ -10350,6 +10350,33 @@
"attribute": false,
"autofill": false,
"class": "Str",
+ "cli_name": "name_from_ip",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "IP network to create reverse zone name from",
+ "exclude": null,
+ "flags": [],
+ "hint": null,
+ "include": null,
+ "label": "Reverse zone IP network",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": false,
+ "name": "name_from_ip",
+ "noextrawhitespace": true,
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": false,
+ "query": false,
+ "required": false,
+ "type": "unicode"
+ },
+ {
+ "alwaysask": false,
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
"cli_name": "name_server",
"cli_short_name": null,
"default": null,
@@ -11047,12 +11074,12 @@
{
"alwaysask": false,
"attribute": false,
- "autofill": false,
+ "autofill": true,
"class": "StrEnum",
"cli_name": "type",
"cli_short_name": null,
- "default": null,
- "doc": "Rule type (allow or deny)",
+ "default": "allow",
+ "doc": "Rule type (allow)",
"exclude": null,
"flags": [],
"hint": null,
@@ -14456,12 +14483,12 @@
"cli_name": "runasusercat",
"cli_short_name": null,
"default": null,
- "doc": "Run As User category the rule applies to",
+ "doc": "RunAs User category the rule applies to",
"exclude": null,
"flags": [],
"hint": null,
"include": null,
- "label": "Run As User category",
+ "label": "RunAs User category",
"multivalue": false,
"name": "ipasudorunasusercategory",
"primary_key": false,
@@ -14480,12 +14507,12 @@
"cli_name": "runasgroupcat",
"cli_short_name": null,
"default": null,
- "doc": "Run As Group category the rule applies to",
+ "doc": "RunAs Group category the rule applies to",
"exclude": null,
"flags": [],
"hint": null,
"include": null,
- "label": "Run As Group category",
+ "label": "RunAs Group category",
"multivalue": false,
"name": "ipasudorunasgroupcategory",
"primary_key": false,
@@ -14752,7 +14779,7 @@
"cli_name": "ipasudorunas_user",
"cli_short_name": null,
"default": null,
- "doc": "Run As User",
+ "doc": "RunAs User",
"exclude": null,
"flags": [
"no_update",
@@ -14761,7 +14788,7 @@
],
"hint": null,
"include": null,
- "label": "Run As User",
+ "label": "RunAs User",
"length": null,
"maxlength": null,
"minlength": null,
@@ -14783,7 +14810,7 @@
"cli_name": "ipasudorunas_group",
"cli_short_name": null,
"default": null,
- "doc": "Run As Group",
+ "doc": "RunAs Group",
"exclude": null,
"flags": [
"no_update",
@@ -14792,7 +14819,7 @@
],
"hint": null,
"include": null,
- "label": "Run As Group",
+ "label": "RunAs Group",
"length": null,
"maxlength": null,
"minlength": null,
@@ -16167,9 +16194,7 @@
"memberof_group": [
"admins"
],
- "nsaccountlock": [
- "False"
- ],
+ "nsaccountlock": false,
"objectclass": [
"top",
"person",