From ec8fcc7302993000f96ae02f11d53571f526d5f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Mart=C3=ADn?= Date: Wed, 4 Oct 2017 12:50:27 +0200 Subject: [PATCH] change param name and comments updated --- lib/cartodb/api/auth_api.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/cartodb/api/auth_api.js b/lib/cartodb/api/auth_api.js index e99d78b6..6a639aae 100644 --- a/lib/cartodb/api/auth_api.js +++ b/lib/cartodb/api/auth_api.js @@ -19,22 +19,22 @@ function AuthApi(pgConnection, metadataBackend, mapStore, templateMaps) { module.exports = AuthApi; -// Check if a request is authorized by a signer +// Check if the user is authorized by a signer // -// @param req express request object +// @param res express response object // @param callback function(err, signed_by) signed_by will be // null if the request is not signed by anyone // or will be a string cartodb username otherwise. // -AuthApi.prototype.authorizedBySigner = function(locals, callback) { - if ( ! locals.token || ! locals.signer ) { +AuthApi.prototype.authorizedBySigner = function(params, callback) { + if ( ! params.token || ! params.signer ) { return callback(null, false); // no signer requested } var self = this; - var layergroup_id = locals.token; - var auth_token = locals.auth_token; + var layergroup_id = params.token; + var auth_token = params.auth_token; this.mapStore.load(layergroup_id, function(err, mapConfig) { if (err) { @@ -84,6 +84,7 @@ AuthApi.prototype.authorizedByAPIKey = function(user, req, callback) { * Check access authorization * * @param req - standard req object. Importantly contains table and host information + * @param params res.locals parameters. Contains the auth parameters * @param callback function(err, allowed) is access allowed not? */ AuthApi.prototype.authorize = function(req, params, callback) {