diff --git a/config/passport_helpers.js b/config/passport_helpers.js index 07da1396..13ea356e 100644 --- a/config/passport_helpers.js +++ b/config/passport_helpers.js @@ -6,7 +6,7 @@ module.exports.isAuthenticatedOrApiKey = function isAuthenticated(req, res, next if (req.isAuthenticated()) { return next(); } - + // Try authenticate with API KEY if (req.headers.apikey || req.query.apikey || req.body.apikey) { passport.authenticate('localapikey', function (err, user, info) { @@ -29,23 +29,3 @@ module.exports.isAuthenticatedOrApiKey = function isAuthenticated(req, res, next } }; - -module.exports.hasRole = function hasRole(roleRequired) { - if (!roleRequired) { - throw new Error('Required role needs to be set'); - } - - return function(req, res, next) { - return module.exports.isAuthenticated(req, res, function() { - if (req.user && req.user.roles && req.user.roles.indexOf(roleRequired) !== -1){ - return next(); - } - return res.sendStatus(403); - }); - }; -}; - -module.exports.hasAdminRole = function hasAdminRole() { - return module.exports.hasRole('admin'); -}; -