summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2015-07-09 00:12:00 +0200
committerPetr Vobornik <pvoborni@redhat.com>2015-07-09 10:58:40 +0200
commitcf8b56cc75af43a26f1bd7fadb29a2ab0dd64633 (patch)
treeb1ee9fb72a5b9fb4a1184dad67fd6de66a7d92dd
parent7c481b1e90dbb6821b71707c4012b3857adb84e2 (diff)
downloadfreeipa-cf8b56cc75af43a26f1bd7fadb29a2ab0dd64633.tar.gz
freeipa-cf8b56cc75af43a26f1bd7fadb29a2ab0dd64633.tar.xz
freeipa-cf8b56cc75af43a26f1bd7fadb29a2ab0dd64633.zip
webui: show multiple cert
New certificate widget which replaced certificate status widget. It can display multiple certs. Drawback is that it cannot display if the certificate was revoked. Web UI does not have the information. part of: https://fedorahosted.org/freeipa/ticket/5045 Reviewed-By: Martin Basti <mbasti@redhat.com>
-rw-r--r--install/ui/less/widgets.less12
-rwxr-xr-xinstall/ui/src/freeipa/certificate.js90
-rw-r--r--install/ui/src/freeipa/host.js5
-rw-r--r--install/ui/src/freeipa/service.js5
-rw-r--r--install/ui/src/freeipa/user.js4
-rw-r--r--install/ui/test/data/ipa_init.json3
-rw-r--r--ipalib/plugins/internal.py3
7 files changed, 116 insertions, 6 deletions
diff --git a/install/ui/less/widgets.less b/install/ui/less/widgets.less
index 7778f6bf4..99b22068d 100644
--- a/install/ui/less/widgets.less
+++ b/install/ui/less/widgets.less
@@ -131,5 +131,17 @@
}
}
+// Certificate Widget
+
+.certificate-widget {
+ label {
+ padding-right: 10px;
+ }
+ .certificate {
+ word-wrap: break-word;
+ padding-bottom: 10px;
+ }
+}
+
// workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=409254
tbody:empty { display: none; } \ No newline at end of file
diff --git a/install/ui/src/freeipa/certificate.js b/install/ui/src/freeipa/certificate.js
index 71f0dfbf5..93f3cfc68 100755
--- a/install/ui/src/freeipa/certificate.js
+++ b/install/ui/src/freeipa/certificate.js
@@ -1000,6 +1000,95 @@ IPA.cert.status_field = function(spec) {
return that;
};
+IPA.cert.cert_widget = function(spec) {
+
+ spec = spec || {};
+ spec.css_class = spec.css_class || 'certificate-widget';
+
+ var that = IPA.input_widget(spec);
+ that.certs_visible = false;
+
+ that.create = function(container) {
+
+ that.widget_create(container);
+ that.content_el = $('<div>').appendTo(container);
+ };
+
+ that.create_status = function(name, text, icon) {
+
+ var status = $('<label/>', {
+ 'class': 'certificate-status'
+ });
+
+ $('<i/>', {
+ 'class': icon
+ }).appendTo(status);
+
+ status.append(" " + text);
+
+ return status;
+ };
+
+ that.create_certs = function() {
+
+ that.content_el.empty();
+ var l = that.certificates.length;
+
+ if (l && that.certs_visible) {
+ for (var i=0; i<l; i++) {
+ $('<div/>', {
+ 'class': 'certificate',
+ text: that.certificates[i]
+ }).appendTo(that.content_el);
+ }
+ $('<div/>').append(
+ IPA.button({
+ name: 'hide',
+ label: '@i18n:buttons.hide',
+ click: function() {
+ that.certs_visible = false;
+ that.create_certs();
+ }
+ })).
+ appendTo(that.content_el);
+ }
+
+ if (!l) {
+ that.content_el.append(that.create_status(
+ 'missing',
+ text.get('@i18n:objects.cert.missing'),
+ 'fa fa-warning'));
+ }
+
+ if (l && !that.certs_visible) {
+
+ var msg = text.get('@i18n:objects.cert.present');
+ msg = msg.replace('${count}', l);
+ that.content_el.append(
+ that.create_status('present', msg, 'fa fa-check'));
+
+ IPA.button({
+ name: 'show',
+ label: '@i18n:buttons.show',
+ click: function() {
+ that.certs_visible = true;
+ that.create_certs();
+ }
+ }).appendTo(that.content_el);
+ }
+ };
+
+ that.update = function(values) {
+ that.certificates = values;
+ that.create_certs();
+ };
+
+ that.clear = function() {
+ that.content_el.empty();
+ };
+
+ return that;
+};
exp.create_cert_metadata = function() {
@@ -1409,6 +1498,7 @@ exp.register = function() {
var f = reg.field;
var a = reg.action;
+ w.register('certificate', IPA.cert.cert_widget);
w.register('certificate_status', IPA.cert.status_widget);
f.register('certificate_status', IPA.cert.status_field);
diff --git a/install/ui/src/freeipa/host.js b/install/ui/src/freeipa/host.js
index 17fe423e5..e033279b2 100644
--- a/install/ui/src/freeipa/host.js
+++ b/install/ui/src/freeipa/host.js
@@ -140,9 +140,8 @@ return {
name: 'certificate',
fields: [
{
- $type: 'certificate_status',
- name: 'certificate_status',
- label: '@i18n:objects.host.status'
+ $type: 'certificate',
+ name: 'usercertificate'
}
]
},
diff --git a/install/ui/src/freeipa/service.js b/install/ui/src/freeipa/service.js
index 5b469b5e1..28a01f635 100644
--- a/install/ui/src/freeipa/service.js
+++ b/install/ui/src/freeipa/service.js
@@ -134,9 +134,8 @@ return {
name: 'certificate',
fields: [
{
- $type: 'certificate_status',
- name: 'certificate_status',
- label: '@i18n:objects.service.status'
+ $type: 'certificate',
+ name: 'usercertificate'
}
]
},
diff --git a/install/ui/src/freeipa/user.js b/install/ui/src/freeipa/user.js
index 33bc6ec10..e30311bbf 100644
--- a/install/ui/src/freeipa/user.js
+++ b/install/ui/src/freeipa/user.js
@@ -175,6 +175,10 @@ return {
label: '@i18n:objects.sshkeystore.keys'
},
{
+ $type: 'certificate',
+ name: 'usercertificate'
+ },
+ {
$type: 'checkboxes',
name: 'ipauserauthtype',
flags: ['w_if_no_aci'],
diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json
index 21b12f144..ef1729505 100644
--- a/install/ui/test/data/ipa_init.json
+++ b/install/ui/test/data/ipa_init.json
@@ -73,6 +73,7 @@
"filter": "Filter",
"find": "Find",
"get": "Get",
+ "hide": "Hide",
"issue": "Issue",
"ok": "OK",
"refresh": "Refresh",
@@ -85,6 +86,7 @@
"revoke": "Revoke",
"save": "Save",
"set": "Set",
+ "show": "Show",
"unapply": "Un-apply",
"update": "Update",
"view": "View"
@@ -253,6 +255,7 @@
"note": "Note",
"organization": "Organization",
"organizational_unit": "Organizational Unit",
+ "present": "${count} certificate(s) present",
"privilege_withdrawn": "Privilege Withdrawn",
"reason": "Reason for Revocation",
"remove_from_crl": "Remove from CRL",
diff --git a/ipalib/plugins/internal.py b/ipalib/plugins/internal.py
index ae019e7ef..f97885cea 100644
--- a/ipalib/plugins/internal.py
+++ b/ipalib/plugins/internal.py
@@ -216,6 +216,7 @@ class i18n_messages(Command):
"filter": _("Filter"),
"find": _("Find"),
"get": _("Get"),
+ "hide": _("Hide"),
"issue": _("Issue"),
"ok": _("OK"),
"refresh": _("Refresh"),
@@ -228,6 +229,7 @@ class i18n_messages(Command):
"revoke": _("Revoke"),
"save": _("Save"),
"set": _("Set"),
+ "show": _("Show"),
"unapply": ("Un-apply"),
"update": _("Update"),
"view": _("View"),
@@ -397,6 +399,7 @@ class i18n_messages(Command):
"note": _("Note"),
"organization": _("Organization"),
"organizational_unit": _("Organizational Unit"),
+ "present": _("${count} certificate(s) present"),
"privilege_withdrawn": _("Privilege Withdrawn"),
"reason": _("Reason for Revocation"),
"remove_from_crl": _("Remove from CRL"),