Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
Merge pull request #576 from simison/patch-8
Browse files Browse the repository at this point in the history
Remove unused hasAuthorization and requiresLogin
  • Loading branch information
ilanbiala committed May 31, 2015
2 parents 3ea400f + fcb6f90 commit 801ba33
Showing 1 changed file with 0 additions and 32 deletions.
Expand Up @@ -20,35 +20,3 @@ exports.userByID = function(req, res, next, id) {
next();
});
};

/**
* Require login routing middleware
*/
exports.requiresLogin = function(req, res, next) {
if (!req.isAuthenticated()) {
return res.status(401).send({
message: 'User is not logged in'
});
}

next();
};

/**
* User authorizations routing middleware
*/
exports.hasAuthorization = function(roles) {
var _this = this;

return function(req, res, next) {
_this.requiresLogin(req, res, function() {
if (_.intersection(req.user.roles, roles).length) {
return next();
} else {
return res.status(403).send({
message: 'User is not authorized'
});
}
});
};
};

0 comments on commit 801ba33

Please sign in to comment.