diff --git a/lib/cartodb/server.js b/lib/cartodb/server.js index 47637a6d..18328507 100644 --- a/lib/cartodb/server.js +++ b/lib/cartodb/server.js @@ -798,10 +798,9 @@ module.exports = function(serverOptions) { // app.authorizedBySigner = function(req, callback) { if ( ! req.params.token || ! req.params.signer ) { - return callback(null, null); // no signer requested + return callback(null, false); // no signer requested } - var signer = req.params.signer; var layergroup_id = req.params.token; var auth_token = req.params.auth_token; @@ -812,7 +811,7 @@ module.exports = function(serverOptions) { var authorized = templateMaps.isAuthorized(mapConfig.obj().template, auth_token); - return callback(null, authorized ? signer : null); + return callback(null, authorized); }); }; @@ -877,12 +876,12 @@ module.exports = function(serverOptions) { callback(err, true); // authorized (or error) }); }, - function checkSignAuthorized(err, signed_by){ + function checkSignAuthorized(err, authorized) { if (err) { return callback(err); } - if ( ! signed_by ) { + if ( ! authorized ) { // request not authorized by signer. // if no signer name was given, let dbparams and @@ -896,7 +895,7 @@ module.exports = function(serverOptions) { return callback(null, false); } - pgConnection.setDBAuth(signed_by, req.params, function(err) { + pgConnection.setDBAuth(user, req.params, function(err) { if (req.profiler) { req.profiler.done('setDBAuth'); }