more tests

This commit is contained in:
Barış Soner Uşaklı
2017-05-10 16:27:44 -04:00
parent 873801e9f3
commit 73f31640d7
4 changed files with 62 additions and 22 deletions

View File

@@ -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;