db/SecurityManager.js: convert checkAccess() to thenify

This commit is contained in:
Ray Bellis 2019-01-23 16:25:29 +00:00
parent 23a3a079a6
commit 34fdaa4e8c

View file

@ -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);
});
};
});