From f967a5ecdc4557ffeeead40fdc08b4b6fa4bb216 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Sun, 29 Mar 2015 22:27:07 +0100 Subject: [PATCH] Fix auth on comms link and for anon user The move to honour scope level of token broke the comms link checking as well as the permissions checking for anon users. --- red/api/auth/index.js | 2 +- red/api/auth/permissions.js | 2 +- red/api/auth/strategies.js | 4 ++-- red/comms.js | 12 ++++++++++-- test/red/api/auth/permissions_spec.js | 1 + test/red/api/auth/strategies_spec.js | 23 ++++++++++++++++++++--- test/red/comms_spec.js | 20 ++++++++++++++------ 7 files changed, 49 insertions(+), 15 deletions(-) diff --git a/red/api/auth/index.js b/red/api/auth/index.js index 137ac6d49..6c0938468 100644 --- a/red/api/auth/index.js +++ b/red/api/auth/index.js @@ -101,7 +101,7 @@ module.exports = { errorHandler: function(err,req,res,next) { //TODO: standardize json response //TODO: audit log statment - console.log(err.stack); + //console.log(err.stack); //log.log({level:"audit",type:"auth",msg:err.toString()}); return server.errorHandler()(err,req,res,next); }, diff --git a/red/api/auth/permissions.js b/red/api/auth/permissions.js index e0398c7ba..132269a5a 100644 --- a/red/api/auth/permissions.js +++ b/red/api/auth/permissions.js @@ -38,7 +38,7 @@ function hasPermission(userScope,permission) { } if (util.isArray(permission)) { - for (var i=0;i