summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorEndi Sukma Dewata <edewata@redhat.com>2011-12-07 20:39:52 -0600
committerPetr Vobornik <pvoborni@redhat.com>2011-12-09 15:55:13 +0100
commit7cb39b8e33561d549c671389d38a8fa2c708ef3c (patch)
tree1cafac449cf34c1a34a60c9384125c2f06070751 /install
parentb70ebe5c9f718d184ae6a60931fdccf0e22b9c48 (diff)
downloadfreeipa-7cb39b8e33561d549c671389d38a8fa2c708ef3c.tar.gz
freeipa-7cb39b8e33561d549c671389d38a8fa2c708ef3c.tar.xz
freeipa-7cb39b8e33561d549c671389d38a8fa2c708ef3c.zip
Added HBAC Test input validation.
The HBAC Test pages have been modified to validate required input before executing the test. Ticket #388
Diffstat (limited to 'install')
-rw-r--r--install/ui/hbactest.js23
-rw-r--r--install/ui/test/data/sudorule_get_records.json79
2 files changed, 101 insertions, 1 deletions
diff --git a/install/ui/hbactest.js b/install/ui/hbactest.js
index 916a23803..f2256a31c 100644
--- a/install/ui/hbactest.js
+++ b/install/ui/hbactest.js
@@ -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);
diff --git a/install/ui/test/data/sudorule_get_records.json b/install/ui/test/data/sudorule_get_records.json
index b0d82b880..1c740edd5 100644
--- a/install/ui/test/data/sudorule_get_records.json
+++ b/install/ui/test/data/sudorule_get_records.json
@@ -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"