mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 20:16:04 +01:00
more tests
This commit is contained in:
@@ -1,18 +1,22 @@
|
||||
'use strict';
|
||||
|
||||
var async = require('async');
|
||||
|
||||
var user = require('../user');
|
||||
var adminBlacklistController = require('./admin/blacklist');
|
||||
|
||||
var globalModsController = {};
|
||||
var globalModsController = module.exports;
|
||||
|
||||
globalModsController.ipBlacklist = function (req, res, next) {
|
||||
user.isAdminOrGlobalMod(req.uid, function (err, isAdminOrGlobalMod) {
|
||||
if (err || !isAdminOrGlobalMod) {
|
||||
return next(err);
|
||||
}
|
||||
|
||||
adminBlacklistController.get(req, res, next);
|
||||
});
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
user.isAdminOrGlobalMod(req.uid, next);
|
||||
},
|
||||
function (isAdminOrGlobalMod, next) {
|
||||
if (!isAdminOrGlobalMod) {
|
||||
return next();
|
||||
}
|
||||
adminBlacklistController.get(req, res, next);
|
||||
},
|
||||
], next);
|
||||
};
|
||||
|
||||
module.exports = globalModsController;
|
||||
|
||||
Reference in New Issue
Block a user