From 34fdaa4e8c656d13bd2cc33d5396cbe4aa7e8367 Mon Sep 17 00:00:00 2001 From: Ray Bellis Date: Wed, 23 Jan 2019 16:25:29 +0000 Subject: [PATCH] db/SecurityManager.js: convert checkAccess() to thenify --- src/node/db/SecurityManager.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/node/db/SecurityManager.js b/src/node/db/SecurityManager.js index bc8f59426..e9aefcd61 100644 --- a/src/node/db/SecurityManager.js +++ b/src/node/db/SecurityManager.js @@ -27,6 +27,7 @@ var sessionManager = require("./SessionManager"); var settings = require("../utils/Settings"); var log4js = require('log4js'); var authLogger = log4js.getLogger("auth"); +const thenify = require("thenify").withCallback; /** * This function controlls the access to a pad, it checks if the user can access a pad. @@ -36,7 +37,7 @@ var authLogger = log4js.getLogger("auth"); * @param password the password the user has given to access this pad, can be null * @param callback will be called with (err, {accessStatus: grant|deny|wrongPassword|needPassword, authorID: a.xxxxxx}) */ -exports.checkAccess = function(padID, sessionCookie, token, password, callback) +exports.checkAccess = thenify(function(padID, sessionCookie, token, password, callback) { var statusObject; @@ -300,4 +301,4 @@ exports.checkAccess = function(padID, sessionCookie, token, password, callback) callback(null, statusObject); }); -}; +});