From 9cb3a07acad861712f64ce3fc0d1157a32a72381 Mon Sep 17 00:00:00 2001 From: Adam Young Date: Wed, 6 Oct 2010 17:24:58 -0400 Subject: [PATCH] policy and config Population of the policy and entites tabs. DNS and ACI are broken due to PLugin issues Fix for entities without search Added new files to Makefile.am used rolegroup.js file as the start point, renamed to serverconfig.js --- install/static/Makefile.am | 3 +- install/static/details.js | 10 +-- install/static/entity.js | 23 +++-- install/static/index.xhtml | 6 +- install/static/policy.js | 151 +++++++++++++++++++++++++++++++++ install/static/rolegroup.js | 45 ---------- install/static/serverconfig.js | 118 ++++++++++++++++++++++++++ install/static/webui.js | 17 +++- ipalib/plugins/automount.py | 2 + ipalib/plugins/krbtpolicy.py | 2 + ipalib/plugins/pwpolicy.py | 2 + 11 files changed, 314 insertions(+), 65 deletions(-) create mode 100644 install/static/policy.js delete mode 100644 install/static/rolegroup.js create mode 100644 install/static/serverconfig.js diff --git a/install/static/Makefile.am b/install/static/Makefile.am index 7d7c27d9a..8071d25f1 100644 --- a/install/static/Makefile.am +++ b/install/static/Makefile.am @@ -28,7 +28,8 @@ app_DATA = \ navigation.js \ netgroup.js \ service.js \ - rolegroup.js \ + serverconfig.js \ + policy.js \ search.js \ details.js \ entity.js \ diff --git a/install/static/details.js b/install/static/details.js index 62c5c5eb1..41f3a5101 100644 --- a/install/static/details.js +++ b/install/static/details.js @@ -125,14 +125,14 @@ function ipa_details_load(jobj, pkey, on_win, on_fail) details.append('

'+error_thrown.message+'

'); }; - if (!pkey) - return; - + var params = [pkey]; + if (!pkey){ + params = []; + } ipa_cmd( - 'show', [pkey], {all: true}, load_on_win, load_on_fail, obj_name + 'show', params, {all: true}, load_on_win, load_on_fail, obj_name ); } - function ipa_details_update(obj_name, pkey, on_win, on_fail) { function update_on_win(data, text_status, xhr) { diff --git a/install/static/entity.js b/install/static/entity.js index c628edd07..804f8e22d 100644 --- a/install/static/entity.js +++ b/install/static/entity.js @@ -49,16 +49,21 @@ function ipa_entity_set_association_definition(obj_name, data) ipa_entity_association_list[obj_name] = data; } -function ipa_entity_setup(container) + +function ipa_details_only_setup(container){ + ipa_entity_setup(container, 'details'); +} + +function ipa_entity_setup(container, unspecified) { var id = container.attr('id'); var state = id + '-facet'; - var facet = $.bbq.getState(state, true) || 'search'; + var facet = $.bbq.getState(state, true) || unspecified || 'search'; var last_facet = window_hash_cache[state]; if (facet != last_facet) { - _ipa_entity_setup(container); + _ipa_entity_setup(container,unspecified); window_hash_cache[state] = facet; } else if (facet == 'search') { @@ -90,7 +95,7 @@ function ipa_entity_setup(container) } } -function _ipa_entity_setup(jobj) { +function _ipa_entity_setup(jobj,unspecified) { var obj_name = jobj.attr('id'); @@ -137,15 +142,16 @@ function _ipa_entity_setup(jobj) { search_load(jobj, filter, null, null); }; - function setup_details_facet() { + function setup_details_facet(unspecified) { var pkey = $.bbq.getState(obj_name + '-pkey', true); ipa_entity_generate_views(obj_name, jobj, switch_view); ipa_details_create(obj_name, ipa_entity_details_list[obj_name], jobj); jobj.find('.details-reset').click(reset_on_click); jobj.find('.details-update').click(update_on_click); - if (pkey) + if (pkey||unspecified){ ipa_details_load(jobj, pkey, null, null); + } }; function setup_associate_facet() { @@ -175,11 +181,12 @@ function _ipa_entity_setup(jobj) { jobj.empty(); - var facet = $.bbq.getState(obj_name + '-facet', true) || 'search'; + var facet = $.bbq.getState(obj_name + '-facet', true) || + unspecified || 'search'; if (facet == 'search') { setup_search_facet(); } else if (facet == 'details') { - setup_details_facet(); + setup_details_facet(unspecified); } else if (facet == 'associate') { setup_associate_facet(); } diff --git a/install/static/index.xhtml b/install/static/index.xhtml index 2e2ac4ef3..338ddbb6b 100644 --- a/install/static/index.xhtml +++ b/install/static/index.xhtml @@ -25,7 +25,9 @@ - + + + @@ -37,7 +39,7 @@
Logged in as: user@FREEIP.ORG diff --git a/install/static/policy.js b/install/static/policy.js new file mode 100644 index 000000000..7f0d43b5b --- /dev/null +++ b/install/static/policy.js @@ -0,0 +1,151 @@ +/* Authors: + * Adam Young + * + * Copyright (C) 2010 Red Hat + * see file 'COPYING' for use and warranty information + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; version 2 only + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */ + +ipa_entity_set_search_definition('hbac', [ + ['cn', 'Name', null], + ['description', 'description', null], + ['quick_links', 'Quick Links', ipa_entity_quick_links] +]); + +ipa_entity_set_add_definition('hbac', [ + 'dialog-add-hbac', 'Add New Zone', [ + ['cn', 'Name', null], + ] +]); + +ipa_entity_set_details_definition('hbac', [ + ['identity', 'HBAC Details', [ + ['cn', 'HBAC Name'], + ["accessruletype", "Rule Type"], + [ "description", "Description"], + ["hostcategory", "Host Category"], + ["ipaenabledflag", "Enabled"], + ["servicecategory", "Service Category"], + ["sourcehostcategory", "Source Host Category"], + ["usercategory", "User Category"] + ]] +]); + +ipa_entity_set_association_definition('hbac', { +}); + +/* DNS */ +ipa_entity_set_search_definition('dns', [ + ['idnsname', 'Zone Name', null], + ['quick_links', 'Quick Links', ipa_entity_quick_links] +]); + +ipa_entity_set_add_definition('dns', [ + 'dialog-add-dns', 'Add New Zone', [ + ['idnsname', 'Name', null], + ['idnssoamname', 'Authoritative name server'], + ['idnssoarname','administrator e-mail address'], + ] +]); + +ipa_entity_set_details_definition('dns', [ + ['identity', 'DNS Zone Details', [ + ['idnsname', 'DNS Name'], + ['idnszoneactive', 'Zone Active'], + ['idnssoamname', 'Authoritative name server'], + ['idnssoarname','administrator e-mail address'], + ['idnssoaserial', 'SOA serial'], + ['idnssoarefresh', 'SOA refresh'], + ['idnssoaretry', 'SOA retry'], + ['idnssoaexpire','SOA expire'], + ['idnssoaminimum', 'SOA minimum'], + ['dnsttl','SOA time to live'], + ['dnsclass','SOA class'], + ['idnsallowdynupdate','allow dynamic update?'], + ['idnsupdatepolicy', 'BIND update policy'], + ]] +]); + +ipa_entity_set_association_definition('dns', { +}); + + +/**Automount*/ + +ipa_entity_set_search_definition('automountlocation', [ + ['cn', 'Name', null], + ['quick_links', 'Quick Links', ipa_entity_quick_links] + +]); + +ipa_entity_set_add_definition('automountlocation', [ + 'dialog-add-location', 'Add New Location', [ + ['cn', 'Name', null], + ] +]); + +ipa_entity_set_details_definition('automountlocation', [ + ['identity', 'Automount Location Details', [ + ['cn', 'Automount Location'],] +]]); + +ipa_entity_set_association_definition('automountlocation', { +}); + + +/**pwpolicy*/ + +ipa_entity_set_search_definition('pwpolicy', [ + ['cn', 'Name', null], + ['quick_links', 'Quick Links', ipa_entity_quick_links] + +]); + +ipa_entity_set_add_definition('pwpolicy', [ + 'dialog-add-dns', 'Add New Location', [ + ['cn', 'Name', null], + ] +]); + +ipa_entity_set_details_definition('pwpolicy', [ + ['identity', 'Password Policy', [ + ["krbmaxpwdlife","Max Password Life"], + ["krbminpwdlife","Min Password Life"], + ["krbpwdhistorylength","Password History Length"], + ["krbpwdmindiffchars", "Min Different Characters"], + ["krbpwdminlength", "Password Minimum Length"] + ]] +]); + +ipa_entity_set_association_definition('pwpolicy', { +}); + + +/** + krbtpolicy + Does not have search +*/ + +ipa_entity_set_details_definition('krbtpolicy', [ + ['identity', 'Krbtpolicy Location Details', [ + ['cn', 'Krbtpolicy Location'], + ["krbmaxrenewableage", "Max Renewable Age"], + ["krbmaxticketlife", "Max Ticket Life"] +]]]); + +ipa_entity_set_association_definition('krbtpolicy', { +}); diff --git a/install/static/rolegroup.js b/install/static/rolegroup.js deleted file mode 100644 index 64728ab23..000000000 --- a/install/static/rolegroup.js +++ /dev/null @@ -1,45 +0,0 @@ -/* Authors: - * Endi Sukma Dewata - * - * Copyright (C) 2010 Red Hat - * see file 'COPYING' for use and warranty information - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; version 2 only - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */ - -ipa_entity_set_search_definition('rolegroup', [ - ['cn', 'Role-group name', null], - ['description', 'Description', null], - ['quick_links', 'Quick Links', ipa_entity_quick_links] -]); - -ipa_entity_set_add_definition('rolegroup', [ - 'dialog-add-rolegroup', 'Add New Rolegroup', [ - ['cn', 'Name', null], - ['description', 'Description', null], - ] -]); - -ipa_entity_set_details_definition('rolegroup', [ - ['identity', 'Rolegroup Details', [ - ['cn', 'Name', null], - ['description', 'Description', null], - ]] -]); - -ipa_entity_set_association_definition('rolegroup', { - 'taskgroup': { associator: SerialAssociator } -}); diff --git a/install/static/serverconfig.js b/install/static/serverconfig.js new file mode 100644 index 000000000..97a436fd3 --- /dev/null +++ b/install/static/serverconfig.js @@ -0,0 +1,118 @@ +/* Authors: + * Endi Sukma Dewata + * Adam Young + * + * Copyright (C) 2010 Red Hat + * see file 'COPYING' for use and warranty information + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; version 2 only + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */ + + + +/* ACI */ +ipa_entity_set_search_definition('aci', [ + ['cn', 'ACI name', null], + ['quick_links', 'Quick Links', ipa_entity_quick_links] +]); + +ipa_entity_set_add_definition('aci', [ + 'dialog-add-aci', 'Add New Aci', [ + ['cn', 'Name', null], + ['description', 'Description', null], + ] +]); + +ipa_entity_set_details_definition('aci', [ + ['ipaserver', 'Aci Details', [ + ['cn', 'Name', null], + ['description', 'Description', null], + ]] +]); + + +/* Taskgroup*/ + +ipa_entity_set_search_definition('taskgroup', [ + ['cn', 'Role-group name', null], + ['description', 'Description', null], + ['quick_links', 'Quick Links', ipa_entity_quick_links] +]); + +ipa_entity_set_add_definition('taskgroup', [ + 'dialog-add-taskgroup', 'Add New Taskgroup', [ + ['cn', 'Name', null], + ['description', 'Description', null], + ] +]); + +ipa_entity_set_details_definition('taskgroup', [ + ['ipaserver', 'Taskgroup Details', [ + ['cn', 'Name', null], + ['description', 'Description', null], + ]] +]); + +ipa_entity_set_association_definition('rolegroup', { + 'rolegroup': { associator: BulkAssociator } +}); + + + + +/* Rolegroup*/ + +ipa_entity_set_search_definition('rolegroup', [ + ['cn', 'Role-group name', null], + ['description', 'Description', null], + ['quick_links', 'Quick Links', ipa_entity_quick_links] +]); + +ipa_entity_set_add_definition('rolegroup', [ + 'dialog-add-rolegroup', 'Add New Rolegroup', [ + ['cn', 'Name', null], + ['description', 'Description', null], + ] +]); + +ipa_entity_set_details_definition('rolegroup', [ + ['ipaserver', 'Rolegroup Details', [ + ['cn', 'Name', null], + ['description', 'Description', null], + ]] +]); + +ipa_entity_set_association_definition('rolegroup', { + 'taskgroup': { associator: SerialAssociator } +}); + +/* Configuration */ +ipa_entity_set_details_definition('config',[ + ['ipaserver', 'Configuration', [ + ['cn', 'Name', null], + ['description', 'Description', null], + ['ipacertificatesubjectbase', 'Certificat Subject Base',null], + [ 'ipadefaultloginshell', 'Default Login Shell',null], + ['ipadefaultprimarygroup', 'Default Primary Group',null], + ['ipagroupsearchfields', 'Group Search Fields',null], + ['ipahomesrootdir', 'Home Root Dir',null], + ['ipamaxusernamelength', 'Max Username Length',null], + ['ipamigrationenabled', 'Migration enabled?',null], + ['ipasearchrecordslimit', 'Search Record Limit',null], + ['ipasearchtimelimit', 'Search Time Limit',null], + ['ipausersearchfields', 'User Search Fields',null] + ]] +]); diff --git a/install/static/webui.js b/install/static/webui.js index 958095561..a53824bde 100644 --- a/install/static/webui.js +++ b/install/static/webui.js @@ -24,7 +24,7 @@ var admin_tab_set = [ - {name:'identity', label:'IDENTITY', children:[ + {name:'identity', children:[ {name:'user', label:'Users', setup: ipa_entity_setup}, {name:'group', label:'Groups', setup: ipa_entity_setup}, {name:'host', label:'Hosts', setup: ipa_entity_setup}, @@ -32,9 +32,18 @@ var admin_tab_set = [ {name:'netgroup', label:'Netgroups', setup: ipa_entity_setup}, {name:'service', label:'Services', setup: ipa_entity_setup} ]}, - {name:'policy', label:'POLICY', setup: unimplemented_tab}, - {name:'config', label:'CONFIG', children: [ - {name:'rolegroup', label:'Rolegroups', setup: ipa_entity_setup} + {name:'policy', children:[ + {name:'hbac', setup: ipa_entity_setup}, + {name:'dns', setup: ipa_entity_setup}, + {name:'automountlocation', setup: ipa_entity_setup}, + {name:'pwpolicy', setup: ipa_entity_setup}, + {name:'krbtpolicy', setup:ipa_details_only_setup} + ]}, + {name:'ipaserver', children: [ +// {name:'aci', setup: ipa_entity_setup}, + {name:'taskgroup', setup: ipa_entity_setup}, + {name:'rolegroup', label:'Rolegroups', setup: ipa_entity_setup}, + {name:'config', setup: ipa_details_only_setup} ]} ]; diff --git a/ipalib/plugins/automount.py b/ipalib/plugins/automount.py index 030a32ca6..d9436a2bc 100644 --- a/ipalib/plugins/automount.py +++ b/ipalib/plugins/automount.py @@ -100,6 +100,8 @@ class automountlocation(LDAPObject): object_name_plural = 'automount locations' object_class = ['nscontainer'] default_attributes = ['cn'] + label = _('Automount') + takes_params = ( Str('cn', diff --git a/ipalib/plugins/krbtpolicy.py b/ipalib/plugins/krbtpolicy.py index 5d773d205..7b1d14c2b 100644 --- a/ipalib/plugins/krbtpolicy.py +++ b/ipalib/plugins/krbtpolicy.py @@ -56,6 +56,8 @@ class krbtpolicy(LDAPObject): object_name = 'kerberos ticket policy settings' default_attributes = ['krbmaxticketlife', 'krbmaxrenewableage'] + label=_('Kerberos Ticket Policy') + takes_params = ( Str('uid?', cli_name='user', diff --git a/ipalib/plugins/pwpolicy.py b/ipalib/plugins/pwpolicy.py index cbfbf8019..5e81631f4 100644 --- a/ipalib/plugins/pwpolicy.py +++ b/ipalib/plugins/pwpolicy.py @@ -167,6 +167,8 @@ class pwpolicy(LDAPObject): 'krbpwdhistorylength', 'krbpwdmindiffchars', 'krbpwdminlength', ] + label = _('Password Policy') + takes_params = ( Str('cn?', cli_name='group',