Certificates ui section and permissions
This commit is contained in:
@ -4,6 +4,7 @@ const _ = require('lodash');
|
||||
const error = require('../lib/error');
|
||||
const redirectionHostModel = require('../models/redirection_host');
|
||||
const internalHost = require('./host');
|
||||
const internalNginx = require('./nginx');
|
||||
const internalAuditLog = require('./audit-log');
|
||||
|
||||
function omissions () {
|
||||
@ -49,6 +50,13 @@ const internalRedirectionHost = {
|
||||
.omit(omissions())
|
||||
.insertAndFetch(data);
|
||||
})
|
||||
.then(row => {
|
||||
// Configure nginx
|
||||
return internalNginx.configure(redirectionHostModel, 'redirection_host', row)
|
||||
.then(() => {
|
||||
return internalRedirectionHost.get(access, {id: row.id, expand: ['owner']});
|
||||
});
|
||||
})
|
||||
.then(row => {
|
||||
// Add to audit log
|
||||
return internalAuditLog.add(access, {
|
||||
@ -58,7 +66,7 @@ const internalRedirectionHost = {
|
||||
meta: data
|
||||
})
|
||||
.then(() => {
|
||||
return _.omit(row, omissions());
|
||||
return row;
|
||||
});
|
||||
});
|
||||
},
|
||||
@ -192,6 +200,13 @@ const internalRedirectionHost = {
|
||||
.patch({
|
||||
is_deleted: 1
|
||||
})
|
||||
.then(() => {
|
||||
// Delete Nginx Config
|
||||
return internalNginx.deleteConfig('redirection_host', row)
|
||||
.then(() => {
|
||||
return internalNginx.reload();
|
||||
});
|
||||
})
|
||||
.then(() => {
|
||||
// Add to audit log
|
||||
row.meta = internalHost.cleanMeta(row.meta);
|
||||
|
Reference in New Issue
Block a user