Custom SSL certificates config panel
Adds a new panel to the superuser config tool, for managing custom SSL certificates in the config bundle [Delivers #135586525]
This commit is contained in:
parent
773f271daa
commit
7e0fbeb625
14 changed files with 434 additions and 41 deletions
|
@ -1254,6 +1254,56 @@ angular.module("core-config-setup", ['angularFileUpload'])
|
|||
return directiveDefinitionObject;
|
||||
})
|
||||
|
||||
.directive('configCertificatesField', function () {
|
||||
var directiveDefinitionObject = {
|
||||
priority: 0,
|
||||
templateUrl: '/static/directives/config/config-certificates-field.html',
|
||||
replace: false,
|
||||
transclude: false,
|
||||
restrict: 'C',
|
||||
scope: {
|
||||
},
|
||||
controller: function($scope, $element, $upload, ApiService, UserService) {
|
||||
$scope.resetUpload = 0;
|
||||
|
||||
var loadCertificates = function() {
|
||||
$scope.certificatesResource = ApiService.getCustomCertificatesAsResource().get(function(resp) {
|
||||
$scope.certInfo = resp;
|
||||
});
|
||||
};
|
||||
|
||||
UserService.updateUserIn($scope, function(user) {
|
||||
if (!user.anonymous) {
|
||||
loadCertificates();
|
||||
}
|
||||
});
|
||||
|
||||
$scope.handleCertsSelected = function(files, callback) {
|
||||
$upload.upload({
|
||||
url: '/api/v1/superuser/customcerts/' + files[0].name,
|
||||
method: 'POST',
|
||||
data: {'_csrf_token': window.__token},
|
||||
file: files[0]
|
||||
}).success(function() {
|
||||
callback(true);
|
||||
$scope.resetUpload++;
|
||||
loadCertificates();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.deleteCert = function(path) {
|
||||
var errorDisplay = ApiService.errorDisplay('Could not delete certificate');
|
||||
var params = {
|
||||
'certpath': path
|
||||
};
|
||||
|
||||
ApiService.deleteCustomCertificate(null, params).then(loadCertificates, errorDisplay);
|
||||
};
|
||||
}
|
||||
};
|
||||
return directiveDefinitionObject;
|
||||
})
|
||||
|
||||
.directive('configLicenseField', function () {
|
||||
var directiveDefinitionObject = {
|
||||
priority: 0,
|
||||
|
|
Reference in a new issue