From 7c481b1e90dbb6821b71707c4012b3857adb84e2 Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Wed, 8 Jul 2015 22:04:45 +0200 Subject: webui: cert-request improvements Certificate request action and dialog now supports 'profile_id', 'add' and 'principal' options. 'add' and 'principal' are disaplayed only if certificate is added from certificate search facet. Certificate search facet allows to add a certificate. User details facet allows to add a certificate. part of https://fedorahosted.org/freeipa/ticket/5046 Reviewed-By: Martin Basti --- install/ui/src/freeipa/certificate.js | 137 +++++++++++++++++++++++++++------- install/ui/src/freeipa/host.js | 6 +- install/ui/src/freeipa/service.js | 6 +- install/ui/src/freeipa/user.js | 45 +++++++++-- install/ui/test/data/ipa_init.json | 4 +- ipalib/plugins/internal.py | 4 +- 6 files changed, 168 insertions(+), 34 deletions(-) diff --git a/install/ui/src/freeipa/certificate.js b/install/ui/src/freeipa/certificate.js index 28d0407db..71f0dfbf5 100755 --- a/install/ui/src/freeipa/certificate.js +++ b/install/ui/src/freeipa/certificate.js @@ -21,6 +21,7 @@ define([ 'dojo/_base/lang', + './builder', './metadata', './ipa', './jquery', @@ -30,7 +31,9 @@ define([ './rpc', './text', './dialog'], - function(lang, metadata_provider, IPA, $, menu, phases, reg, rpc, text) { + function( + lang, builder, metadata_provider, IPA, $, menu, + phases, reg, rpc, text) { var exp = IPA.cert = {}; @@ -395,11 +398,42 @@ IPA.cert.request_dialog = function(spec) { spec = spec || {}; + spec.sections = spec.sections || []; + var section = { fields: [] }; + spec.sections.push(section); + + if (spec.show_principal) { + section.fields.push( + { + $type: 'text', + name: 'principal', + label: '@mc-opt:cert_request:principal:label', + required: true + }, + { + $type: 'checkbox', + name: 'add', + label: '@i18n:objects.cert.add_principal', + tooltip: '@mc-opt:cert_request:add:doc' + } + ); + } + section.fields.push( + { + $type: 'entity_select', + name: 'profile_id', + other_entity: 'certprofile', + other_field: 'cn', + label: '@mc-opt:cert_request:profile_id:label' + } + ); + var that = IPA.dialog(spec); that.width = spec.width || 600; that.height = spec.height || 480; that.message = text.get(spec.message); + that.show_principal = spec.show_principal; that.request = spec.request; @@ -408,8 +442,10 @@ IPA.cert.request_dialog = function(spec) { label: '@i18n:buttons.issue', click: function() { var values = {}; + that.save(values); var request = $.trim(that.textarea.val()); values.request = IPA.cert.pem_csr_format(request); + if (that.request) { that.request(values); } @@ -426,11 +462,16 @@ IPA.cert.request_dialog = function(spec) { }); that.create_content = function() { - that.container.append(that.message); - + that.dialog_create_content(); + var node = $("
", { + 'class': 'col-sm-12' + }); + node.append(that.message); that.textarea = $('