Re: [Freeipa-devel] [PATCH] Host certificate management

2010-10-20 Thread Adam Young

On 10/19/2010 06:50 PM, Endi Sukma Dewata wrote:

On 10/19/2010 4:34 PM, Adam Young wrote:

For the most part looks ok. I don't like the appraoch to validating
preconditions where we raise an alert for each. Also, make sure you
don't code styles like color right into the Javascript, that stuff
belonds in ipa.css.

With those changes, ACK


OK, attached is an updated patch.

As I mentioned in the irc the alert is raised only once, just for the 
first error. This alert indicates a programming error, not user error, 
because those parameters are required to use the certificate status 
panel correctly. For now I've removed them until we decide how to 
handle such error properly.


I've moved the bullet styles into ipa.css. We will need to replace 
them with real images.



ACK,

Pushed to master

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Re: [Freeipa-devel] [PATCH] Host certificate management

2010-10-19 Thread Endi Sukma Dewata

On 10/19/2010 4:34 PM, Adam Young wrote:

For the most part looks ok. I don't like the appraoch to validating
preconditions where we raise an alert for each. Also, make sure you
don't code styles like color right into the Javascript, that stuff
belonds in ipa.css.

With those changes, ACK


OK, attached is an updated patch.

As I mentioned in the irc the alert is raised only once, just for the 
first error. This alert indicates a programming error, not user error, 
because those parameters are required to use the certificate status 
panel correctly. For now I've removed them until we decide how to handle 
such error properly.


I've moved the bullet styles into ipa.css. We will need to replace them 
with real images.


--
Endi S. Dewata
From cff4496b217e5491496dfb4dcd25e1f7ce3bc0f0 Mon Sep 17 00:00:00 2001
From: Endi S. Dewata 
Date: Fri, 15 Oct 2010 23:40:38 -0500
Subject: [PATCH] Host certificate management

The service certificate management UI has been generalized and moved
into certificate.js. The host details page is now using the same code
to manage certificates. The host.py has been modified to return host
certificate info.

The Get/Revoke/View buttons behavior has been modified such that they
are visible only if there is a valid certificate. The Get dialog box
has been fixed to show the correct certificate header and footer.

The ipa.css has been modified to store the style of the status bullets.
New unit tests for certificate has been added. The test data has been
modified to include sample host certificate.
---
 install/static/certificate.js  |  317 +++-
 install/static/host.js |   41 -
 install/static/ipa.css |   19 ++
 install/static/service.js  |  290 ++---
 install/static/test/all_tests.html |4 +-
 install/static/test/association_tests.html |2 +-
 install/static/test/certificate_tests.html |   24 ++
 install/static/test/certificate_tests.js   |   79 +++
 install/static/test/data/cert_show.json|1 -
 install/static/test/data/host_show.json|   14 ++-
 install/static/test/details_tests.html |2 +-
 install/static/test/entity_tests.html  |2 +-
 install/static/test/index.html |1 +
 install/static/test/ipa_tests.html |2 +-
 install/static/test/navigation_tests.html  |2 +-
 ipalib/plugins/host.py |   35 +++
 16 files changed, 549 insertions(+), 286 deletions(-)
 create mode 100755 install/static/test/certificate_tests.html
 create mode 100755 install/static/test/certificate_tests.js

diff --git a/install/static/certificate.js b/install/static/certificate.js
index a688fe8..e1297a8 100755
--- a/install/static/certificate.js
+++ b/install/static/certificate.js
@@ -18,6 +18,9 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
+var BEGIN_CERTIFICATE = '-BEGIN CERTIFICATE-';
+var END_CERTIFICATE   = '-END CERTIFICATE-';
+
 var BEGIN_CERTIFICATE_REQUEST = '-BEGIN CERTIFICATE REQUEST-';
 var END_CERTIFICATE_REQUEST   = '-END CERTIFICATE REQUEST-';
 
@@ -35,19 +38,33 @@ var CRL_REASON = [
 'AA Compromise'
 ];
 
+var CERTIFICATE_STATUS_MISSING = 0;
+var CERTIFICATE_STATUS_VALID   = 1;
+var CERTIFICATE_STATUS_REVOKED = 2;
+
 function certificate_parse_dn(dn) {
 
 var result = {};
+if (!dn) return result;
 
 // TODO: Use proper LDAP DN parser
 var rdns = dn.split(',');
 for (var i=0; i');
+spec = spec || {};
+
+that.entity_type = spec.entity_type;
+that.entity_label = spec.entity_label || that.entity_type;
+
+that.result = spec.result;
+
+that.get_entity_pkey = spec.get_entity_pkey;
+that.get_entity_name = spec.get_entity_name;
+that.get_entity_principal = spec.get_entity_principal;
+that.get_entity_certificate = spec.get_entity_certificate;
+
+var li1, li2, li3;
+
+function init() {
+var pkey = that.get_entity_pkey(that.result);
+
+var table = $('').appendTo(that);
+
+var tr = $('').appendTo(table);
+
+var td = $('').appendTo(tr);
+li1 = $('', {
+'class': 'certificate-status-valid'
+}).appendTo(td);
+
+td = $('').appendTo(tr);
+td.append('Valid Certificate Present:');
+
+td = $('').appendTo(tr);
+$('', {
+'id': 'get_button',
+'type': 'button',
+'value': 'Get',
+'click': function() {
+ipa_cmd(that.entity_type+'_show', [pkey], {},
+function(data, text_status, xhr) {
+get_certificate(data.result.result);
+}
+);
+}
+}).appendTo(td);
+
+$('', {
+'id': 'revoke_button',
+'type': 'button',
+'value': 'Revoke',
+'click': function() {
+ipa_cmd(that.entity_typ

Re: [Freeipa-devel] [PATCH] Host certificate management

2010-10-19 Thread Adam Young

On 10/19/2010 03:12 PM, Endi Sukma Dewata wrote:

Hi,

Please review the attached patch. Thanks!

https://fedorahosted.org/reviewboard/r/94/

The service certificate management UI has been generalized and moved
into certificate.js. The host details page is now using the same code
to manage certificates. The host.py has been modified to return host
certificate info.

The Get/Revoke/View buttons behavior has been modified such that they
are visible only if there is a valid certificate. The Get dialog box
has been fixed to show the correct certificate header and footer.

New unit tests for certificate has been added. The test data has been
modified to include sample host certificate.


___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel



For the most part looks ok.  I don't like the appraoch to validating 
preconditions where we raise an alert for each.  Also, make sure you 
don't code styles like color right into the Javascript, that stuff 
belonds in ipa.css.


With those changes, ACK
___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel