feat: Add check templates enabled middleware
This commit is contained in:
12
packages/backend/src/helpers/check-templates-enabled.js
Normal file
12
packages/backend/src/helpers/check-templates-enabled.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import Config from '../models/config.js';
|
||||
import NotAuthorizedError from '../errors/not-authorized.js';
|
||||
|
||||
export const checkTemplatesEnabled = async (request, response, next) => {
|
||||
const config = await Config.get();
|
||||
|
||||
if (!config.enableTemplates) {
|
||||
throw new NotAuthorizedError();
|
||||
}
|
||||
|
||||
next();
|
||||
};
|
||||
Reference in New Issue
Block a user