mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Fixed problem enabling/disabling DNS zone.
The details facet for DNS zone has been modified to use dnszone- enable/disable for idnszoneactive and dnszone-mod for other fields. Ticket #1813
This commit is contained in:
parent
c981627016
commit
26a2fa027d
@ -38,12 +38,13 @@ IPA.entity_factories.dnszone = function() {
|
||||
facet_groups([ 'dnsrecord', 'settings' ]).
|
||||
search_facet({
|
||||
title: IPA.metadata.objects.dnszone.label,
|
||||
columns:['idnsname']
|
||||
columns: [ 'idnsname' ]
|
||||
}).
|
||||
details_facet({
|
||||
sections:[{
|
||||
name:'identity',
|
||||
fields:[
|
||||
factory: IPA.dnszone_details_facet,
|
||||
sections: [{
|
||||
name: 'identity',
|
||||
fields: [
|
||||
'idnsname',
|
||||
'idnszoneactive',
|
||||
'idnssoamname',
|
||||
@ -56,7 +57,9 @@ IPA.entity_factories.dnszone = function() {
|
||||
'dnsttl',
|
||||
'dnsclass',
|
||||
'idnsallowdynupdate',
|
||||
'idnsupdatepolicy']}]
|
||||
'idnsupdatepolicy'
|
||||
]
|
||||
}]
|
||||
}).
|
||||
nested_search_facet({
|
||||
facet_group: 'dnsrecord',
|
||||
@ -66,7 +69,7 @@ IPA.entity_factories.dnszone = function() {
|
||||
label: IPA.metadata.objects.dnsrecord.label,
|
||||
load: IPA.dns_record_search_load,
|
||||
get_values: IPA.dnsrecord_get_delete_values,
|
||||
columns:[
|
||||
columns: [
|
||||
{
|
||||
name: 'idnsname',
|
||||
label: IPA.get_entity_param('dnsrecord', 'idnsname').label,
|
||||
@ -109,6 +112,110 @@ IPA.entity_factories.dnszone = function() {
|
||||
build();
|
||||
};
|
||||
|
||||
IPA.dnszone_details_facet = function(spec) {
|
||||
|
||||
spec = spec || {};
|
||||
|
||||
var that = IPA.details_facet(spec);
|
||||
|
||||
that.update = function(on_success, on_error) {
|
||||
|
||||
var args = that.get_primary_key();
|
||||
|
||||
var modify_operation = {
|
||||
execute: false,
|
||||
command: IPA.command({
|
||||
entity: that.entity.name,
|
||||
method: 'mod',
|
||||
args: args,
|
||||
options: { all: true, rights: true }
|
||||
})
|
||||
};
|
||||
|
||||
var enable_operation = {
|
||||
execute: false,
|
||||
command: IPA.command({
|
||||
entity: that.entity.name,
|
||||
method: 'enable',
|
||||
args: args,
|
||||
options: { all: true, rights: true }
|
||||
})
|
||||
};
|
||||
|
||||
var sections = that.sections.values;
|
||||
for (var i=0; i<sections.length; i++) {
|
||||
var section = sections[i];
|
||||
|
||||
var section_fields = section.fields.values;
|
||||
for (var j=0; j<section_fields.length; j++) {
|
||||
var field = section_fields[j];
|
||||
if (!field.is_dirty()) continue;
|
||||
|
||||
var values = field.save();
|
||||
if (!values) continue;
|
||||
|
||||
var param_info = field.param_info;
|
||||
|
||||
// skip primary key
|
||||
if (param_info && param_info.primary_key) continue;
|
||||
|
||||
// check enable/disable
|
||||
if (field.name == 'idnszoneactive') {
|
||||
if (values[0] == 'FALSE') enable_operation.command.method = 'disable';
|
||||
enable_operation.execute = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (param_info) {
|
||||
if (values.length == 1) {
|
||||
modify_operation.command.set_option(field.name, values[0]);
|
||||
} else if (field.join) {
|
||||
modify_operation.command.set_option(field.name, values.join(','));
|
||||
} else {
|
||||
modify_operation.command.set_option(field.name, values);
|
||||
}
|
||||
|
||||
} else {
|
||||
if (values.length) {
|
||||
modify_operation.command.set_option('setattr', field.name+'='+values[0]);
|
||||
} else {
|
||||
modify_operation.command.set_option('setattr', field.name+'=');
|
||||
}
|
||||
for (var l=1; l<values.length; l++) {
|
||||
modify_operation.command.set_option('addattr', field.name+'='+values[l]);
|
||||
}
|
||||
}
|
||||
|
||||
modify_operation.execute = true;
|
||||
}
|
||||
}
|
||||
|
||||
var batch = IPA.batch_command({
|
||||
name: 'dnszone_details_update',
|
||||
on_success: function(data, text_status, xhr) {
|
||||
that.refresh();
|
||||
if (on_success) on_success.call(this, data, text_status, xhr);
|
||||
},
|
||||
on_error: function(xhr, text_status, error_thrown) {
|
||||
that.refresh();
|
||||
if (on_error) on_error.call(this, xhr, text_status, error_thrown);
|
||||
}
|
||||
});
|
||||
|
||||
if (modify_operation.execute) batch.add_command(modify_operation.command);
|
||||
if (enable_operation.execute) batch.add_command(enable_operation.command);
|
||||
|
||||
if (!batch.commands.length) {
|
||||
that.refresh();
|
||||
return;
|
||||
}
|
||||
|
||||
batch.execute();
|
||||
};
|
||||
|
||||
return that;
|
||||
};
|
||||
|
||||
IPA.dnszone_adder_dialog = function(spec) {
|
||||
|
||||
spec = spec || {};
|
||||
|
@ -321,14 +321,14 @@ IPA.hbacrule_details_facet = function(spec) {
|
||||
|
||||
that.update = function(on_success, on_error) {
|
||||
|
||||
var pkey = IPA.nav.get_state(that.entity.name+'-pkey');
|
||||
var args = that.get_primary_key();
|
||||
|
||||
var modify_operation = {
|
||||
'execute': false,
|
||||
'command': IPA.command({
|
||||
entity: that.entity.name,
|
||||
method: 'mod',
|
||||
args: [pkey],
|
||||
args: args,
|
||||
options: {all: true, rights: true}
|
||||
})
|
||||
};
|
||||
@ -355,7 +355,7 @@ IPA.hbacrule_details_facet = function(spec) {
|
||||
'command': IPA.command({
|
||||
entity: that.entity.name,
|
||||
method: 'remove_user',
|
||||
args: [pkey],
|
||||
args: args,
|
||||
options: {all: true, rights: true}
|
||||
})
|
||||
},
|
||||
@ -365,7 +365,7 @@ IPA.hbacrule_details_facet = function(spec) {
|
||||
'command': IPA.command({
|
||||
entity: that.entity.name,
|
||||
method: 'remove_host',
|
||||
args: [pkey],
|
||||
args: args,
|
||||
options: {all: true, rights: true}
|
||||
})
|
||||
},
|
||||
@ -375,7 +375,7 @@ IPA.hbacrule_details_facet = function(spec) {
|
||||
'command': IPA.command({
|
||||
entity: that.entity.name,
|
||||
method: 'remove_service',
|
||||
args: [pkey],
|
||||
args: args,
|
||||
options: {all: true, rights: true}
|
||||
})
|
||||
},
|
||||
@ -385,7 +385,7 @@ IPA.hbacrule_details_facet = function(spec) {
|
||||
'command': IPA.command({
|
||||
entity: that.entity.name,
|
||||
method: 'remove_sourcehost',
|
||||
args: [pkey],
|
||||
args: args,
|
||||
options: {all: true, rights: true}
|
||||
})
|
||||
}
|
||||
@ -396,7 +396,7 @@ IPA.hbacrule_details_facet = function(spec) {
|
||||
'command': IPA.command({
|
||||
entity: that.entity.name,
|
||||
method: 'enable',
|
||||
args: [pkey],
|
||||
args: args,
|
||||
options: {all: true, rights: true}
|
||||
})
|
||||
};
|
||||
@ -408,15 +408,17 @@ IPA.hbacrule_details_facet = function(spec) {
|
||||
var section_fields = section.fields.values;
|
||||
for (var j=0; j<section_fields.length; j++) {
|
||||
var field = section_fields[j];
|
||||
if (!field.is_dirty()) continue;
|
||||
|
||||
// association tables are never dirty, so call
|
||||
// is_dirty() after checking table values
|
||||
|
||||
var values = field.save();
|
||||
if (!values) continue;
|
||||
|
||||
var param_info = IPA.get_entity_param(that.entity.name, field.name);
|
||||
var param_info = field.param_info;
|
||||
|
||||
// skip primary key
|
||||
if (param_info && param_info['primary_key']) continue;
|
||||
if (param_info && param_info.primary_key) continue;
|
||||
|
||||
var p = field.name.indexOf('_');
|
||||
if (p >= 0) {
|
||||
@ -475,11 +477,11 @@ IPA.hbacrule_details_facet = function(spec) {
|
||||
'name': 'hbac_details_update',
|
||||
'on_success': function(data, text_status, xhr) {
|
||||
that.refresh();
|
||||
if (on_success) on_success(data, text_status, xhr);
|
||||
if (on_success) on_success.call(this, data, text_status, xhr);
|
||||
},
|
||||
'on_error': function(xhr, text_status, error_thrown) {
|
||||
that.refresh();
|
||||
if (on_error) on_error(xhr, text_status, error_thrown);
|
||||
if (on_error) on_error.call(this, xhr, text_status, error_thrown);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -261,14 +261,14 @@ IPA.sudorule_details_facet = function(spec) {
|
||||
|
||||
that.update = function(on_success, on_error) {
|
||||
|
||||
var pkey = IPA.nav.get_state(that.entity.name+'-pkey');
|
||||
var args = that.get_primary_key();
|
||||
|
||||
var modify_operation = {
|
||||
'execute': false,
|
||||
'command': IPA.command({
|
||||
entity: that.entity.name,
|
||||
method: 'mod',
|
||||
args: [pkey],
|
||||
args: args,
|
||||
options: {all: true, rights: true}
|
||||
})
|
||||
};
|
||||
@ -298,7 +298,7 @@ IPA.sudorule_details_facet = function(spec) {
|
||||
'command': IPA.command({
|
||||
entity: that.entity.name,
|
||||
method: 'remove_user',
|
||||
args: [pkey],
|
||||
args: args,
|
||||
options: {all: true, rights: true}
|
||||
})
|
||||
},
|
||||
@ -308,7 +308,7 @@ IPA.sudorule_details_facet = function(spec) {
|
||||
'command': IPA.command({
|
||||
entity: that.entity.name,
|
||||
method: 'remove_host',
|
||||
args: [pkey],
|
||||
args: args,
|
||||
options: {all: true, rights: true}
|
||||
})
|
||||
},
|
||||
@ -318,7 +318,7 @@ IPA.sudorule_details_facet = function(spec) {
|
||||
'command': IPA.command({
|
||||
entity: that.entity.name,
|
||||
method: 'remove_allow_command',
|
||||
args: [pkey],
|
||||
args: args,
|
||||
options: {all: true, rights: true}
|
||||
})
|
||||
},
|
||||
@ -328,7 +328,7 @@ IPA.sudorule_details_facet = function(spec) {
|
||||
'command': IPA.command({
|
||||
entity: that.entity.name,
|
||||
method: 'remove_runasuser',
|
||||
args: [pkey],
|
||||
args: args,
|
||||
options: {all: true, rights: true}
|
||||
})
|
||||
},
|
||||
@ -338,7 +338,7 @@ IPA.sudorule_details_facet = function(spec) {
|
||||
'command': IPA.command({
|
||||
entity: that.entity.name,
|
||||
method: 'remove_runasgroup',
|
||||
args: [pkey],
|
||||
args: args,
|
||||
options: {all: true, rights: true}
|
||||
})
|
||||
}
|
||||
@ -349,7 +349,7 @@ IPA.sudorule_details_facet = function(spec) {
|
||||
'command': IPA.command({
|
||||
entity: that.entity.name,
|
||||
method: 'enable',
|
||||
args: [pkey],
|
||||
args: args,
|
||||
options: {all: true, rights: true}
|
||||
})
|
||||
};
|
||||
@ -361,15 +361,17 @@ IPA.sudorule_details_facet = function(spec) {
|
||||
var section_fields = section.fields.values;
|
||||
for (var j=0; j<section_fields.length; j++) {
|
||||
var field = section_fields[j];
|
||||
if (!field.is_dirty()) continue;
|
||||
|
||||
// association tables are never dirty, so call
|
||||
// is_dirty() after checking table values
|
||||
|
||||
var values = field.save();
|
||||
if (!values) continue;
|
||||
|
||||
var param_info = IPA.get_entity_param(that.entity.name, field.name);
|
||||
var param_info = field.param_info;
|
||||
|
||||
// skip primary key
|
||||
if (param_info && param_info['primary_key']) continue;
|
||||
if (param_info && param_info.primary_key) continue;
|
||||
|
||||
var p = field.name.indexOf('_');
|
||||
if (p >= 0) {
|
||||
@ -427,11 +429,11 @@ IPA.sudorule_details_facet = function(spec) {
|
||||
'name': 'sudorule_details_update',
|
||||
'on_success': function(data, text_status, xhr) {
|
||||
that.refresh();
|
||||
if (on_success) on_success(data, text_status, xhr);
|
||||
if (on_success) on_success.call(this, data, text_status, xhr);
|
||||
},
|
||||
'on_error': function(xhr, text_status, error_thrown) {
|
||||
that.refresh();
|
||||
if (on_error) on_error(xhr, text_status, error_thrown);
|
||||
if (on_error) on_error.call(this, xhr, text_status, error_thrown);
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user