From 4b3f44f0766fc7327d1dcd5528be817cdf6254b0 Mon Sep 17 00:00:00 2001 From: Yuriy Nemtsov Date: Sun, 23 Aug 2015 17:55:20 -0400 Subject: [PATCH] acl/middleware: support `req.user.id` for userId --- lib/acl.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/acl.js b/lib/acl.js index 65d857c..9a062a9 100644 --- a/lib/acl.js +++ b/lib/acl.js @@ -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;