From db822955c2b61b31ba96213ec88c14c2b8d827bc Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Tue, 7 Dec 2010 01:51:51 -0600 Subject: SUDO adjustments The SUDO rule details facet has been updated to support the latest UI spec. The facet consists of 5 sections: general, users, hosts, commands, and run-as. The general section contains the SUDO rule description and status. If the status is changed, the sudorule-enable/disable will be invoked. The other sections contain radio buttons for the association category and tables for the members. When a member is added or removed, the category will be adjusted appropriately. If the category is changed to 'all', 'allow', or 'deny', all members will be removed. The last section is currently not working because backend support is not yet available. The adder dialog boxes for users, groups, and hosts has been modified to accept external identities. The layout for the base adder dialog was updated. The base dialog class was updated to support templates. The SUDO dialog boxes were implemented using templates. New CSS classes were added to ipa.css. The HBAC rule details facet has been updated as well. --- install/static/hbac.js | 137 ++++++++++++++++--------------------------------- 1 file changed, 44 insertions(+), 93 deletions(-) (limited to 'install/static/hbac.js') diff --git a/install/static/hbac.js b/install/static/hbac.js index 0b642aec..213dd3e4 100755 --- a/install/static/hbac.js +++ b/install/static/hbac.js @@ -191,12 +191,12 @@ function ipa_hbac_details_facet(spec) { } var category = section.create_radio({ name: 'usercategory', label: 'User category' }); - section.add_field(ipa_hbac_association_widget({ + section.add_field(ipa_rule_association_table_widget({ 'id': that.entity_name+'-memberuser_user', 'name': 'memberuser_user', 'label': 'Users', 'category': category, 'other_entity': 'user', 'add_method': 'add_user', 'remove_method': 'remove_user' })); - section.add_field(ipa_hbac_association_widget({ + section.add_field(ipa_rule_association_table_widget({ 'id': that.entity_name+'-memberuser_group', 'name': 'memberuser_group', 'label': 'Groups', 'category': category, 'other_entity': 'group', 'add_method': 'add_user', 'remove_method': 'remove_user' @@ -228,12 +228,12 @@ function ipa_hbac_details_facet(spec) { } category = section.create_radio({ 'name': 'hostcategory', 'label': 'Host category' }); - section.add_field(ipa_hbac_association_widget({ + section.add_field(ipa_rule_association_table_widget({ 'id': that.entity_name+'-memberhost_host', 'name': 'memberhost_host', 'label': 'Hosts', 'category': category, 'other_entity': 'host', 'add_method': 'add_host', 'remove_method': 'remove_host' })); - section.add_field(ipa_hbac_association_widget({ + section.add_field(ipa_rule_association_table_widget({ 'id': that.entity_name+'-memberhost_hostgroup', 'name': 'memberhost_hostgroup', 'label': 'Host Groups', 'category': category, 'other_entity': 'hostgroup', 'add_method': 'add_host', 'remove_method': 'remove_host' @@ -265,12 +265,12 @@ function ipa_hbac_details_facet(spec) { } category = section.create_radio({ 'name': 'servicecategory', 'label': 'Service category' }); - section.add_field(ipa_hbac_association_widget({ + section.add_field(ipa_rule_association_table_widget({ 'id': that.entity_name+'-memberservice_hbacsvc', 'name': 'memberservice_hbacsvc', 'label': 'Services', 'category': category, 'other_entity': 'hbacsvc', 'add_method': 'add_service', 'remove_method': 'remove_service' })); - section.add_field(ipa_hbac_association_widget({ + section.add_field(ipa_rule_association_table_widget({ 'id': that.entity_name+'-memberservice_hbacsvcgroup', 'name': 'memberservice_hbacsvcgroup', 'label': 'Service Groups', 'category': category, 'other_entity': 'hbacsvcgroup', 'add_method': 'add_service', 'remove_method': 'remove_service' @@ -302,12 +302,12 @@ function ipa_hbac_details_facet(spec) { } category = section.create_radio({ 'name': 'sourcehostcategory', 'label': 'Source host category' }); - section.add_field(ipa_hbac_association_widget({ + section.add_field(ipa_rule_association_table_widget({ 'id': that.entity_name+'-sourcehost_host', 'name': 'sourcehost_host', 'label': 'Host', 'category': category, 'other_entity': 'host', 'add_method': 'add_sourcehost', 'remove_method': 'remove_sourcehost' })); - section.add_field(ipa_hbac_association_widget({ + section.add_field(ipa_rule_association_table_widget({ 'id': that.entity_name+'-sourcehost_hostgroup', 'name': 'sourcehost_hostgroup', 'label': 'Host Groups', 'category': category, 'other_entity': 'hostgroup', 'add_method': 'add_sourcehost', 'remove_method': 'remove_sourcehost' @@ -362,16 +362,24 @@ function ipa_hbac_details_facet(spec) { 'commands': [] }; - var member_category = { - 'usercategory': 'memberuser', - 'hostcategory': 'memberhost', - 'servicecategory': 'memberservice', - 'sourcehostcategory': 'sourcehost' + var categories = { + 'usercategory': { + 'remove_values': false + }, + 'hostcategory': { + 'remove_values': false + }, + 'servicecategory': { + 'remove_values': false + }, + 'sourcehostcategory': { + 'remove_values': false + } }; - var remove_members = { + var member_operations = { 'memberuser': { - 'category_changed': false, + 'category': 'usercategory', 'has_values': false, 'command': ipa_command({ 'method': that.entity_name+'_remove_user', @@ -380,7 +388,7 @@ function ipa_hbac_details_facet(spec) { }) }, 'memberhost': { - 'category_changed': false, + 'category': 'hostcategory', 'has_values': false, 'command': ipa_command({ 'method': that.entity_name+'_remove_host', @@ -389,7 +397,7 @@ function ipa_hbac_details_facet(spec) { }) }, 'memberservice': { - 'category_changed': false, + 'category': 'servicecategory', 'has_values': false, 'command': ipa_command({ 'method': that.entity_name+'_remove_service', @@ -398,7 +406,7 @@ function ipa_hbac_details_facet(spec) { }) }, 'sourcehost': { - 'category_changed': false, + 'category': 'sourcehostcategory', 'has_values': false, 'command': ipa_command({ 'method': that.entity_name+'_remove_sourcehost', @@ -427,6 +435,7 @@ function ipa_hbac_details_facet(spec) { var span = $('span[name='+field.name+']', div).first(); var values = field.save(); + if (!values) continue; var param_info = ipa_get_param_info(that.entity_name, field.name); @@ -440,8 +449,8 @@ function ipa_hbac_details_facet(spec) { var other_entity = field.name.substring(p+1); if (values.length) { - remove_members[attribute].command.set_option(other_entity, values.join(',')); - remove_members[attribute].has_values = true; + member_operations[attribute].command.set_option(other_entity, values.join(',')); + member_operations[attribute].has_values = true; } continue; } @@ -467,10 +476,16 @@ function ipa_hbac_details_facet(spec) { continue; } + if (categories[field.name]) { + if (values[0] == 'all') { + categories[field.name].remove_values = true; + } + } + // use setattr/addattr if param_info not available if (!param_info) { for (var k=0; k