feat: stub code for v3 chats api

This commit is contained in:
Julian Lam
2021-12-10 17:16:54 -05:00
parent a115b771f0
commit 02e878be72
5 changed files with 105 additions and 0 deletions

View File

@@ -133,6 +133,14 @@ module.exports = function (middleware) {
controllers.helpers.notAllowed(req, res);
});
middleware.canChat = helpers.try(async (req, res, next) => {
const canChat = await privileges.global.can('chat', req.uid);
if (canChat) {
return next();
}
controllers.helpers.notAllowed(req, res);
});
middleware.checkAccountPermissions = helpers.try(async (req, res, next) => {
// This middleware ensures that only the requested user and admins can pass