Skip to content

Commit

Permalink
Merge pull request OptimalBits#149 from nemtsov/patch-1
Browse files Browse the repository at this point in the history
acl/middleware: support `req.user.id` for userId
  • Loading branch information
manast committed Sep 20, 2015
2 parents c25e9f6 + 4b3f44f commit a075ee2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/acl.js
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,8 @@ Acl.prototype.middleware = function(numPathComponents, userId, actions){
if (!userId) {
if((req.session) && (req.session.userId)){
_userId = req.session.userId;
}else if((req.user) && (req.user.id)){
_userId = req.user.id;
}else{
next(new HttpError(401, 'User not authenticated'));
return;
Expand Down

0 comments on commit a075ee2

Please sign in to comment.