change param name and comments updated

This commit is contained in:
Simon Martín
2017-10-04 12:50:27 +02:00
parent 1c3f2b93e3
commit ec8fcc7302
+7 -6
View File
@@ -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) {