admin: display serial in hexadecimal

This commit is contained in:
nemunaire 2019-02-05 01:44:41 +01:00
parent 14d31737e0
commit 703eaef880
3 changed files with 26 additions and 8 deletions

View file

@ -550,6 +550,11 @@ angular.module("FICApp")
.controller("PKIController", function($scope, $rootScope, Certificate, CACertificate, Team, $location, $http) { .controller("PKIController", function($scope, $rootScope, Certificate, CACertificate, Team, $location, $http) {
$scope.teams = Team.query(); $scope.teams = Team.query();
$scope.certificates = Certificate.query(); $scope.certificates = Certificate.query();
$scope.certificates.$promise.then(function(certificates) {
certificates.forEach(function(certificate, cid) {
certificate.serial = parseInt(certificate.id).toString(16);
});
});
$scope.ca = CACertificate.get(); $scope.ca = CACertificate.get();
$scope.revoke = function() { $scope.revoke = function() {
@ -558,7 +563,11 @@ angular.module("FICApp")
Certificate.delete({ serial: targetserial }).$promise.then( Certificate.delete({ serial: targetserial }).$promise.then(
function() { function() {
$('#revokeModal').modal('hide'); $('#revokeModal').modal('hide');
$scope.certificates = Certificate.query(); $scope.certificates = Certificate.query().$promise.then(function(certificates) {
certificates.forEach(function(certificate, cid) {
certificate.serial = parseInt(certificate.id).toString(16);
});
});
}, function(response) { }, function(response) {
$rootScope.newBox('danger', 'An error occurs when trying to associate certificate:', response.data.errmsg); $rootScope.newBox('danger', 'An error occurs when trying to associate certificate:', response.data.errmsg);
} }
@ -1532,6 +1541,11 @@ angular.module("FICApp")
}) })
.controller("TeamCertificatesController", function($scope, $rootScope, TeamCertificate, $routeParams, $http) { .controller("TeamCertificatesController", function($scope, $rootScope, TeamCertificate, $routeParams, $http) {
$scope.certificates = TeamCertificate.query({ teamId: $routeParams.teamId }); $scope.certificates = TeamCertificate.query({ teamId: $routeParams.teamId });
$scope.certificates.$promise.then(function(certificates) {
certificates.forEach(function(certificate, cid) {
certificate.serial = parseInt(certificate.id).toString(16);
});
});
$scope.dissociateCertificate = function(certificate) { $scope.dissociateCertificate = function(certificate) {
$http({ $http({
@ -1541,7 +1555,11 @@ angular.module("FICApp")
id_team: null id_team: null
} }
}).then(function(response) { }).then(function(response) {
$scope.certificates = TeamCertificate.query({ teamId: $routeParams.teamId }); $scope.certificates = TeamCertificate.query({ teamId: $routeParams.teamId }).$promise.then(function(certificates) {
certificates.forEach(function(certificate, cid) {
certificate.serial = parseInt(certificate.id).toString(16);
});
});
$rootScope.newBox('success', 'Certificate successfully dissociated!'); $rootScope.newBox('success', 'Certificate successfully dissociated!');
}, function(response) { }, function(response) {
$rootScope.newBox('danger', 'An error occurs when dissociating certiticate:', response.data.errmsg); $rootScope.newBox('danger', 'An error occurs when dissociating certiticate:', response.data.errmsg);

View file

@ -16,7 +16,7 @@
</thead> </thead>
<tbody> <tbody>
<tr ng-repeat="certificate in certificates | filter: query" ng-click="show(certificate.id)" ng-class="{'bg-danger': certificate.revoked}"> <tr ng-repeat="certificate in certificates | filter: query" ng-click="show(certificate.id)" ng-class="{'bg-danger': certificate.revoked}">
<td>{{ certificate.id }}</td> <td>{{ certificate.serial | uppercase }}</td>
<td>{{ certificate.creation }}</td> <td>{{ certificate.creation }}</td>
<td ng-if="certificate.id_team"> <td ng-if="certificate.id_team">
<span ng-repeat="team in teams" ng-if="team.id == certificate.id_team"> <span ng-repeat="team in teams" ng-if="team.id == certificate.id_team">
@ -118,9 +118,9 @@
</div> </div>
<dl ng-if="ca.version"> <dl ng-if="ca.version">
<ng-repeat ng-repeat="(k, v) in ca"> <ng-repeat ng-repeat="(k, v) in ca" class="row">
<dt>{{ k }}</dt> <dt class="col-3 text-right">{{ k }}</dt>
<dd ng-if="v.CommonName">/CN={{ v.CommonName }}/OU={{ v.OrganizationalUnit }}/O={{ v.Organization }}/L={{ v.Locality }}/P={{ v.Province }}/C={{ v.Country }}/</dd> <dd class="col-9" ng-if="v.CommonName">/CN={{ v.CommonName }}/OU={{ v.OrganizationalUnit }}/O={{ v.Organization }}/L={{ v.Locality }}/P={{ v.Province }}/C={{ v.Country }}/</dd>
<dd ng-if="!v.CommonName">{{ v }}</dd> <dd class="col-9" ng-if="!v.CommonName">{{ v }}</dd>
</ng-repeat> </ng-repeat>
</dl> </dl>

View file

@ -84,7 +84,7 @@
<button type="button" class="btn btn-sm btn-primary float-right" ng-click="dissociateCertificate(cert)">Dissocier</button> <button type="button" class="btn btn-sm btn-primary float-right" ng-click="dissociateCertificate(cert)">Dissocier</button>
</dt> </dt>
<dd> <dd>
{{ cert.id }} {{ cert.serial | uppercase }}
<span class="badge badge-danger" ng-if="cert.revoked">Révoqué</span> <span class="badge badge-danger" ng-if="cert.revoked">Révoqué</span>
</dd> </dd>
<dt> <dt>