Added HBAC Test input validation.

The HBAC Test pages have been modified to validate required input
before executing the test.

Ticket #388
This commit is contained in:
Endi Sukma Dewata 2011-12-07 20:39:52 -06:00 committed by Petr Vobornik
parent b70ebe5c9f
commit 7cb39b8e33
2 changed files with 101 additions and 1 deletions

View File

@ -407,6 +407,25 @@ IPA.hbac.test_select_facet = function(spec) {
}
};
that.validate = function(record) {
if (record[that.name]) return true;
var dialog = IPA.message_dialog({
title: IPA.messages.dialogs.validation_title,
message: IPA.messages.dialogs.validation_message
});
dialog.on_ok = function() {
var state = {};
state[that.entity.name+'-facet'] = that.name;
IPA.nav.push_state(state);
};
dialog.open();
return false;
};
init();
return that;
@ -675,15 +694,19 @@ IPA.hbac.test_run_facet = function(spec) {
var facet = that.entity.get_facet('user');
facet.save(options);
if (!facet.validate(options)) return;
facet = that.entity.get_facet('targethost');
facet.save(options);
if (!facet.validate(options)) return;
facet = that.entity.get_facet('service');
facet.save(options);
if (!facet.validate(options)) return;
facet = that.entity.get_facet('sourcehost');
facet.save(options);
if (!facet.validate(options)) return;
facet = that.entity.get_facet('rules');
facet.save(options);

View File

@ -7,10 +7,87 @@
{
"error": null,
"result": {
"attributelevelrights": {
"aci": "rscwo",
"cmdcategory": "rscwo",
"cn": "rscwo",
"description": "rscwo",
"externalhost": "rscwo",
"externaluser": "rscwo",
"hostcategory": "rscwo",
"hostmask": "rscwo",
"ipaenabledflag": "rscwo",
"ipasudoopt": "rscwo",
"ipasudorunas": "rscwo",
"ipasudorunasextgroup": "rscwo",
"ipasudorunasextuser": "rscwo",
"ipasudorunasgroup": "rscwo",
"ipasudorunasgroupcategory": "rscwo",
"ipasudorunasusercategory": "rscwo",
"ipauniqueid": "rsc",
"memberallowcmd": "rscwo",
"memberdenycmd": "rscwo",
"memberhost": "rscwo",
"memberuser": "rscwo",
"nsaccountlock": "rscwo",
"usercategory": "rscwo"
},
"cn": [
"test"
],
"dn": "ipauniqueid=4fc57a02-f23311df-b268e50e-a3b3ef71,cn=sudorules,cn=sudo,dc=dev,dc=example,dc=com"
"dn": "ipauniqueid=4fc57a02-f23311df-b268e50e-a3b3ef71,cn=sudorules,cn=sudo,dc=dev,dc=example,dc=com",
"externalhost": [
"external.example.com"
],
"externaluser": [
"external"
],
"ipaenabledflag": [
"TRUE"
],
"ipasudoopt": [
"-H",
"-b"
],
"ipasudorunas_user": [
"admin"
],
"ipasudorunasgroup_group": [
"admins"
],
"ipauniqueid": [
"4fc57a02-f23311df-b268e50e-a3b3ef71"
],
"memberallowcmd_sudocmd": [
"/usr/bin/less"
],
"memberallowcmd_sudocmdgroup": [
"group1"
],
"memberdenycmd_sudocmd": [
"/usr/bin/more"
],
"memberdenycmd_sudocmdgroup": [
"group1",
"group2"
],
"memberhost_host": [
"dev.example.com"
],
"memberhost_hostgroup": [
"production",
"staging"
],
"memberuser_group": [
"editors"
],
"memberuser_user": [
"test"
],
"objectclass": [
"ipaassociation",
"ipasudorule"
]
},
"summary": null,
"value": "test"