mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-14 09:55:47 +01:00
added back isAdmin into admin middleware with a warning
This commit is contained in:
@@ -5,6 +5,7 @@ var app,
|
||||
nconf = require('nconf'),
|
||||
async = require('async'),
|
||||
path = require('path'),
|
||||
winston = require('winston'),
|
||||
user = require('../user'),
|
||||
meta = require('../meta'),
|
||||
plugins = require('../plugins'),
|
||||
@@ -14,6 +15,22 @@ var app,
|
||||
helpers: require('../controllers/helpers')
|
||||
};
|
||||
|
||||
middleware.isAdmin = function(req, res, next) {
|
||||
winston.warn('[middleware.isAdmin] deprecation warning, no need to use this from plugins!');
|
||||
|
||||
if (!req.user) {
|
||||
controllers.helpers.notAllowed(req, res);
|
||||
}
|
||||
|
||||
user.isAdministrator((req.user && req.user.uid) ? req.user.uid : 0, function (err, isAdmin) {
|
||||
if (err || isAdmin) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
controllers.helpers.notAllowed(req, res);
|
||||
});
|
||||
};
|
||||
|
||||
middleware.buildHeader = function(req, res, next) {
|
||||
var uid = req.user ? req.user.uid : 0;
|
||||
async.parallel([
|
||||
|
||||
Reference in New Issue
Block a user