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

Commit

Permalink
Remove un-used hasAuthorization and requiresLogin
Browse files Browse the repository at this point in the history
Looks like these aren't needed now that we have ACL.
  • Loading branch information
simison committed May 28, 2015
1 parent 3ea400f commit fcb6f90
Showing 1 changed file with 0 additions and 32 deletions.
Original file line number Diff line number Diff line change
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 fcb6f90

Please sign in to comment.