From 8d37e00869a724a6476b69008d4a67818b60598d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Wed, 14 Mar 2018 17:25:58 +0100 Subject: [PATCH] Use objects instead of parameter list --- lib/cartodb/controllers/named_maps_admin.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/cartodb/controllers/named_maps_admin.js b/lib/cartodb/controllers/named_maps_admin.js index ef49e652..1555273b 100644 --- a/lib/cartodb/controllers/named_maps_admin.js +++ b/lib/cartodb/controllers/named_maps_admin.js @@ -27,7 +27,7 @@ NamedMapsAdminController.prototype.register = function (app) { localsMiddleware(), credentialsMiddleware(), checkContentType({ action: 'POST', label: 'POST TEMPLATE' }), - authorizedByAPIKey(this.authApi, 'create', 'POST TEMPLATE'), + authorizedByAPIKey({ authApi: this.authApi, action: 'create', label: 'POST TEMPLATE' }), createTemplate(this.templateMaps), sendResponse() ); @@ -39,7 +39,7 @@ NamedMapsAdminController.prototype.register = function (app) { localsMiddleware(), credentialsMiddleware(), checkContentType({ action: 'PUT', label: 'PUT TEMPLATE' }), - authorizedByAPIKey(this.authApi, 'update', 'PUT TEMPLATE'), + authorizedByAPIKey({ authApi: this.authApi, action: 'update', label: 'PUT TEMPLATE' }), updateTemplate(this.templateMaps), sendResponse() ); @@ -50,7 +50,7 @@ NamedMapsAdminController.prototype.register = function (app) { userMiddleware(), localsMiddleware(), credentialsMiddleware(), - authorizedByAPIKey(this.authApi, 'get', 'GET TEMPLATE'), + authorizedByAPIKey({ authApi: this.authApi, action: 'get', label: 'GET TEMPLATE' }), retrieveTemplate(this.templateMaps), sendResponse() ); @@ -61,7 +61,7 @@ NamedMapsAdminController.prototype.register = function (app) { userMiddleware(), localsMiddleware(), credentialsMiddleware(), - authorizedByAPIKey(this.authApi, 'delete', 'DELETE TEMPLATE'), + authorizedByAPIKey({ authApi: this.authApi, action: 'delete', label: 'DELETE TEMPLATE' }), destroyTemplate(this.templateMaps), sendResponse() ); @@ -72,7 +72,7 @@ NamedMapsAdminController.prototype.register = function (app) { userMiddleware(), localsMiddleware(), credentialsMiddleware(), - authorizedByAPIKey(this.authApi, 'list', 'GET TEMPLATE LIST'), + authorizedByAPIKey({ authApi: this.authApi, action: 'list', label: 'GET TEMPLATE LIST' }), listTemplates(this.templateMaps), sendResponse() ); @@ -95,7 +95,7 @@ function checkContentType ({ action, label }) { }; } -function authorizedByAPIKey (authApi, action, label) { +function authorizedByAPIKey ({ authApi, action, label }) { return function authorizedByAPIKeyMiddleware (req, res, next) { const { user } = res.locals;