<commit_before>var HttpError = require('error').HttpError;
var checkAuth = require('./checkAuth');

module.exports = function(req, res, next) {
	checkAuth(req, res, function() {
		if (arguments.length) {
			next(arguments);
		}

		if (!req.user.isAdmin()) {
			return next(new HttpError(403, "Access allowed only for administrators"));
		}

        next();
	});
};
<commit_msg>fix bug in checkAdmin.<commit_after>var HttpError = require('error').HttpError;
var checkAuth = require('./checkAuth');

module.exports = function(req, res, next) {
	checkAuth(req, res, function(err) {
		if (err) {
			return next(arguments);
		}

		if (!req.user.isAdmin()) {
			return next(new HttpError(403, "Access allowed only for administrators"));
		}

        next();
	});
};

{'fraction_non_alphanumeric': 0.16842105263157894, 'fraction_numerical': 0.007894736842105263, 'mean_word_length': 4.10738255033557, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4193427', 'n_tokens_mistral': 266, 'n_tokens_neox': 239, 'n_words': 58}