<commit_before>'use strict';

var articles = require('../controllers/articles');

// Article authorization helpers
var hasAuthorization = function(req, res, next) {
    if (req.article.user.id !== req.user.id) {
        return res.send(401, 'User is not authorized');
    }
    next();
};<commit_msg>Allow for Admin to Edit / Delete<commit_after>'use strict';

var articles = require('../controllers/articles');

// Article authorization helpers
var hasAuthorization = function(req, res, next) {
    if (res.adminEnabled() || (req.article.user && (req.article.user_id === req.user._id))) {
        next();
    }
    else {
        return res.send(401, 'User is not authorized');
    }
};
{'fraction_non_alphanumeric': 0.1615720524017467, 'fraction_numerical': 0.008733624454148471, 'mean_word_length': 3.3821656050955413, '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': '5926160', 'n_tokens_mistral': 212, 'n_tokens_neox': 205, 'n_words': 54}