mirror of https://gitgud.io/fatchan/jschan.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
355 B
18 lines
355 B
'use strict';
|
|
|
|
const cache = {};
|
|
|
|
module.exports = (requiredLevel) => {
|
|
|
|
return cache[requiredLevel] || (function(req, res, next) {
|
|
if (res.locals.permLevel > requiredLevel) {
|
|
return res.status(403).render('message', {
|
|
'title': 'Forbidden',
|
|
'message': 'No Permission',
|
|
'redirect': req.headers.referer || '/'
|
|
});
|
|
}
|
|
next();
|
|
});
|
|
|
|
}
|
|
|