Disable various server/operator routes based on edition

The initial idea was to put an owner flag but this means that the
owner will be visible inside apps.
This commit is contained in:
Girish Ramakrishnan
2018-09-05 13:18:06 -07:00
parent 0439bd8869
commit 3d004b3dcc
3 changed files with 28 additions and 12 deletions

View File

@@ -6,7 +6,8 @@ exports = module.exports = {
scope: scope,
websocketAuth: websocketAuth,
verifyAppOwnership: verifyAppOwnership
verifyAppOwnership: verifyAppOwnership,
verifyOperator: verifyOperator
};
var accesscontrol = require('../accesscontrol.js'),
@@ -161,3 +162,9 @@ function verifyAppOwnership(req, res, next) {
next();
});
}
function verifyOperator(req, res, next) {
if (config.allowOperatorActions()) return next();
next(new HttpError(401, 'Not allowed in this edition'));
}