From 1dc0a3ab3e145e0f8fdfd71a1205b546a906bd51 Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Thu, 7 Oct 2010 14:02:44 -0500 Subject: Certificate management for services. This is an initial implementation of certificate management for services. It addresses the mechanism required to view and update certificates. The complete UI implementation will be addressed in subsequent patches. On the server side, the service.py has been modified to define usercertificate in the service object's takes_params. This is needed to generate the proper JSON metadata which is needed by the UI. It also has been modified to accept null certificate for deletion. On the client side, the service details page has been modified to display the base64-encoded certificate in a text area. When the page is saved, the action handler will store the base64-encoded certificate in the proper JSON structure. Also the service name and service hostname are now displayed in separate fields. The details configuration has been modified to support displaying and updating certificates. The structure is changed to use maps to define sections and fields. A section contains name, label, and an array of fields. A field contains name, label, setup function, load function, and save function. This is used to implement custom interface and behavior for certificates. All other entities, test cases, and test data have been updated accordingly. Some functions and variables have been renamed to improve clarity and consistency. --- install/static/user.js | 104 ++++++++++++++++++++++++------------------------- 1 file changed, 52 insertions(+), 52 deletions(-) (limited to 'install/static/user.js') diff --git a/install/static/user.js b/install/static/user.js index d42d32d5..34ced1ef 100644 --- a/install/static/user.js +++ b/install/static/user.js @@ -39,39 +39,39 @@ ipa_entity_set_add_definition('user', [ ]); ipa_entity_set_details_definition('user', [ - ['identity', 'Identity Details', [ - ['title', 'Title', null], - ['givenname', 'First Name', null], - ['sn', 'Last Name', null], - ['cn', 'Full Name', null], - ['displayname', 'Dispaly Name', null], - ['initials', 'Initials', null] - ]], - ['account', 'Account Details', [ - ['status', 'Account Status', a_status], - ['uid', 'Login', null], - ['userpassword', 'Password', a_password], - ['uidnumber', 'UID', null], - ['gidnumber', 'GID', null], - ['homedirectory', 'homedirectory', null] - ]], - ['contact', 'Contact Details', [ - ['mail', 'E-mail Address', null], - ['telephonenumber', 'Numbers', a_numbers] - ]], - ['address', 'Mailing Address', [ - ['street', 'Address', null], - ['location', 'City', null], - ['state', 'State', a_st], - ['postalcode', 'ZIP', null] - ]], - ['employee', 'Employee Information', [ - ['ou', 'Org. Unit', null], - ['manager', 'Manager', a_manager] - ]], - ['misc', 'Misc. Information', [ - ['carlicense', 'Car License', null] - ]] + {name:'identity', label:'Identity Details', fields:[ + {name:'title', label:'Title'}, + {name:'givenname', label:'First Name'}, + {name:'sn', label:'Last Name'}, + {name:'cn', label:'Full Name'}, + {name:'displayname', label:'Dispaly Name'}, + {name:'initials', label:'Initials'} + ]}, + {name:'account', label:'Account Details', fields:[ + {name:'status', label:'Account Status', load:user_status_load}, + {name:'uid', label:'Login'}, + {name:'userpassword', label:'Password', load:user_password_load}, + {name:'uidnumber', label:'UID'}, + {name:'gidnumber', label:'GID'}, + {name:'homedirectory', label:'homedirectory'} + ]}, + {name:'contact', label:'Contact Details', fields:[ + {name:'mail', label:'E-mail Address'}, + {name:'telephonenumber', label:'Numbers', load:user_telephonenumber_load} + ]}, + {name:'address', label:'Mailing Address', fields:[ + {name:'street', label:'Address'}, + {name:'location', label:'City'}, + {name:'state', label:'State', load:user_state_load}, + {name:'postalcode', label:'ZIP'} + ]}, + {name:'employee', label:'Employee Information', fields:[ + {name:'ou', label:'Org. Unit'}, + {name:'manager', label:'Manager', load:user_manager_load} + ]}, + {name:'misc', label:'Misc. Information', fields:[ + {name:'carlicense', label:'Car License'} + ]} ]); ipa_entity_set_association_definition('user', { @@ -151,29 +151,31 @@ function on_lock_win(data, textStatus, xhr) /* ATTRIBUTE CALLBACKS */ var toggle_temp = 'S Toggle'; -function a_status(jobj, result, mode) +function user_status_load(dt, result) { - if (mode != IPA_DETAILS_POPULATE) - return; - var memberof = result['memberof']; + var dd; + if (memberof) { for (var i = 0; i < memberof.length; ++i) { if (memberof[i].indexOf('cn=inactivated,cn=account inactivation') != -1) { var t = toggle_temp.replace(/S/g, 'Inactive'); - ipa_insert_first_dd(jobj, t); + dd = ipa_create_first_dd(this.name, t); + dt.after(dd); return; } } } - ipa_insert_first_dd(jobj, toggle_temp.replace(/S/g, 'Inactive')); + + dd = ipa_create_first_dd(this.name, toggle_temp.replace(/S/g, 'Inactive')); + dt.after(dd); } var pwd_temp = 'Reset Password'; -function a_password(jobj, result, mode) +function user_password_load(dt, result) { - if (mode == IPA_DETAILS_POPULATE) - ipa_insert_first_dd(jobj, pwd_temp.replace('A', 'userpassword')); + var dd = ipa_create_first_dd(this.name, pwd_temp.replace('A', 'userpassword')); + dt.after(dd); } var select_temp = ''; @@ -184,20 +186,18 @@ var states = [ 'ME', 'MH', 'MD', 'MA', 'MI', 'MN', 'MS', 'MO', 'MT', 'NE', 'NV', 'NH', 'NJ', 'NM', 'NY', 'NC', 'ND', 'MP', 'OH', 'OK', 'OR', 'PW', 'PA', 'PR', 'RI', 'SC', 'SD', 'TN', 'TX', 'UT', 'VT', 'VI', 'VA', - 'WA', 'WV', 'WI', 'WY', '', + 'WA', 'WV', 'WI', 'WY', '' ]; -function a_st(jobj, result, mode) +function user_state_load(dt, result) { - if (mode != IPA_DETAILS_POPULATE) - return; - - var next = jobj.next(); + var next = dt.next(); next.css('clear', 'none'); next.css('width', '70px'); - ipa_insert_first_dd(jobj, select_temp); + var dd = ipa_create_first_dd(this.name, select_temp); + dt.after(dd); - var sel = jobj.next().children().first(); + var sel = dt.next().children().first(); for (var i = 0; i < states.length; ++i) sel.append(option_temp.replace(/V/g, states[i])); @@ -208,10 +208,10 @@ function a_st(jobj, result, mode) sel.val(''); } -function a_numbers(jobj, result, mode) +function user_telephonenumber_load(dt, result) { } -function a_manager(jobj, result, mode) +function user_manager_load(dt, result) { } -- cgit