Certificates ui section and permissions

This commit is contained in:
Jamie Curnow
2018-08-02 19:48:47 +10:00
parent 66e25e315b
commit 1c57ccdc87
65 changed files with 1697 additions and 109 deletions

View File

@ -3,6 +3,7 @@
const _ = require('lodash');
const error = require('../lib/error');
const streamModel = require('../models/stream');
const internalNginx = require('./nginx');
const internalAuditLog = require('./audit-log');
function omissions () {
@ -31,6 +32,13 @@ const internalStream = {
.omit(omissions())
.insertAndFetch(data);
})
.then(row => {
// Configure nginx
return internalNginx.configure(streamModel, 'stream', row)
.then(() => {
return internalStream.get(access, {id: row.id, expand: ['owner']});
});
})
.then(row => {
// Add to audit log
return internalAuditLog.add(access, {
@ -40,7 +48,7 @@ const internalStream = {
meta: data
})
.then(() => {
return _.omit(row, omissions());
return row;
});
});
},
@ -153,6 +161,13 @@ const internalStream = {
.patch({
is_deleted: 1
})
.then(() => {
// Delete Nginx Config
return internalNginx.deleteConfig('stream', row)
.then(() => {
return internalNginx.reload();
});
})
.then(() => {
// Add to audit log
return internalAuditLog.add(access, {