From 8622b9fca2166eb666cd12c4068dd5facf5ce380 Mon Sep 17 00:00:00 2001 From: Pavel Vomacka Date: Fri, 26 Aug 2016 12:50:00 +0200 Subject: [PATCH 1/3] Add support for additional options taken from table facet Sometimes the entity_show command must be called with options which are gathered from result of entity_find command. These options needs to be passed as arguments in URL which points to details page. This functionality is implemented to table facet. There is new property 'additional_navigation_arguments' which is prepared for array of attributes which will be passed to URL. Part of: https://fedorahosted.org/freeipa/ticket/6238 --- install/ui/src/freeipa/facet.js | 49 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/install/ui/src/freeipa/facet.js b/install/ui/src/freeipa/facet.js index 4553c5c..06eca18 100644 --- a/install/ui/src/freeipa/facet.js +++ b/install/ui/src/freeipa/facet.js @@ -1819,6 +1819,15 @@ exp.table_facet = IPA.table_facet = function(spec, no_init) { var that = IPA.facet(spec, no_init); /** + * Names of additional row attributes which will be send to another facet + * during navigation as URL parameters. + * + * @property {Array} + */ + that.additional_navigation_arguments = spec.additional_navigation_arguments; + + + /** * Entity of data displayed in the table * @property {entity.entity} */ @@ -2268,6 +2277,38 @@ exp.table_facet = IPA.table_facet = function(spec, no_init) { /** + * Extract data from command response and return them. + * + * @param pkey {string} primary key of row which is chosen + * @param attrs {Array} names of attributes which will be extracted + */ + that.get_row_attribute_values = function(key, attrs) { + var result = that.data.result.result; + var options = {}; + var row; + + if (result) { + for (var i=0, l=result.length; i Date: Fri, 26 Aug 2016 13:03:58 +0200 Subject: [PATCH 2/3] WebUI: Fix showing certificates issued by sub-CA The cert-show command needs to be called with cacn option. Cacn option is passed using URL attribute. https://fedorahosted.org/freeipa/ticket/6238 --- install/ui/src/freeipa/certificate.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/install/ui/src/freeipa/certificate.js b/install/ui/src/freeipa/certificate.js index 232bdbf..e67c348 100755 --- a/install/ui/src/freeipa/certificate.js +++ b/install/ui/src/freeipa/certificate.js @@ -1543,6 +1543,7 @@ return { row_enabled_attribute: 'status', facet_groups: [exp.facet_group], facet_group: 'certificates', + additional_navigation_arguments: [ 'cacn' ], pagination: false, no_update: true, columns: [ @@ -1552,6 +1553,7 @@ return { width: '90px' }, 'subject', + 'cacn', { name: 'status', width: '120px' @@ -1645,6 +1647,7 @@ return { fields: [ 'serial_number', 'serial_number_hex', + 'cacn', 'subject', { name: 'issuer', @@ -1772,6 +1775,10 @@ IPA.cert.details_facet = function(spec, no_init) { var command = that.details_facet_create_refresh_command(); delete command.options.all; delete command.options.rights; + + command.options = command.options || {}; + $.extend(command.options, { cacn: that.state.cacn }); + return command; }; From f72ae9481df08a76f6d6f48a9a260898d851527f Mon Sep 17 00:00:00 2001 From: Pavel Vomacka Date: Fri, 26 Aug 2016 13:11:22 +0200 Subject: [PATCH 3/3] WebUI add support for sub-CAs while revoking certificates Also the same for removing certificate hold. https://fedorahosted.org/freeipa/ticket/6216 --- install/ui/src/freeipa/certificate.js | 146 ++++++++++++++++++++++++++-------- install/ui/src/freeipa/widget.js | 1 + 2 files changed, 116 insertions(+), 31 deletions(-) diff --git a/install/ui/src/freeipa/certificate.js b/install/ui/src/freeipa/certificate.js index e67c348..ad7fd87 100755 --- a/install/ui/src/freeipa/certificate.js +++ b/install/ui/src/freeipa/certificate.js @@ -244,44 +244,119 @@ IPA.cert.download_dialog = function(spec) { return that; }; -IPA.cert.revoke_dialog = function(spec) { +IPA.cert.revocation_reason_select_widget = function(spec) { + spec = spec || {}; + + var that = IPA.select_widget(spec); + + that.create_options = function() { + for (var i=0; i').appendTo(td); - for (var i=0; i', { - 'value': i, - 'html': text.get('@i18n:objects.cert.'+reason) - }).appendTo(that.select); - } + that.create_button({ + name: 'cancel', + label: '@i18n:buttons.cancel', + click: function() { + that.close(); + } + }); }; + if (!no_init) that.init(); + return that; }; @@ -718,7 +793,7 @@ IPA.cert.request_action = function(spec) { return that; }; -IPA.cert.perform_revoke = function(spec, sn, revocation_reason) { +IPA.cert.perform_revoke = function(spec, sn, revocation_reason, cacn) { spec.hide_activity_icon = spec.hide_activity_icon || false; @@ -728,7 +803,8 @@ IPA.cert.perform_revoke = function(spec, sn, revocation_reason) { hide_activity_icon: spec.hide_activity_icon, args: [ sn ], options: { - 'revocation_reason': revocation_reason + revocation_reason: revocation_reason, + cacn: cacn }, notify_activity_start: spec.notify_activity_start, notify_activity_end: spec.notify_activity_end, @@ -782,7 +858,8 @@ IPA.cert.revoke_action = function(spec) { var sn = facet.certificate.serial_number; var revocation_reason = that.dialog.get_reason(); - IPA.cert.perform_revoke(spec, sn, revocation_reason); + var cacn = that.dialog.get_cacn(); + IPA.cert.perform_revoke(spec, sn, revocation_reason, cacn); }; return that; @@ -835,19 +912,22 @@ IPA.cert.remove_hold_action = function(spec) { } }; - IPA.cert.perform_remove_hold(spec, facet.certificate.serial_number); - + IPA.cert.perform_remove_hold(spec, facet.certificate.serial_number, + facet.state.cacn); }; return that; }; -IPA.cert.perform_remove_hold = function(spec, sn) { +IPA.cert.perform_remove_hold = function(spec, sn, cacn) { rpc.command({ entity: 'cert', method: 'remove_hold', args: [sn], + options: { + cacn: cacn + }, on_success: spec.on_success }).execute(); }; @@ -1360,13 +1440,15 @@ IPA.cert.cert_widget = function(spec) { }; var sn = that.certificate.serial_number; + var cacn = dialog.get_cacn(); var revocation_reason = dialog.get_reason(); - IPA.cert.perform_revoke(command_spec, sn, revocation_reason); + IPA.cert.perform_revoke(command_spec, sn, revocation_reason, cacn); } }; var dialog = IPA.cert.revoke_dialog(spec); dialog.open(); + dialog.set_cacn(that.certificate.cacn); }; that.perform_remove_hold = function() { @@ -1392,7 +1474,8 @@ IPA.cert.cert_widget = function(spec) { }; var sn = that.certificate.serial_number; - IPA.cert.perform_remove_hold(command_spec, sn); + var cacn = that.certificate.cacn; + IPA.cert.perform_remove_hold(command_spec, sn, cacn); } }; @@ -1834,6 +1917,7 @@ exp.register = function() { f.register('certificate_status', IPA.cert.status_field); f.register('revocation_reason', IPA.revocation_reason_field); w.register('revocation_reason', IPA.text_widget); + w.register('revocation_reason_select', IPA.cert.revocation_reason_select_widget); a.register('cert_request', IPA.cert.request_action); a.register('download_cert', IPA.cert.download_action); diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index 9151eba..4769ca6 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -2878,6 +2878,7 @@ IPA.select_widget = function(spec) { // methods that should be invoked by subclasses that.select_save = that.save; that.select_update = that.update; + that.select_create_options = that.create_options; return that; };