From efe090f5b0555459836a5f52e42e4b7cdf777823 Mon Sep 17 00:00:00 2001 From: Raul Ochoa Date: Wed, 28 Jan 2015 17:29:50 +0100 Subject: [PATCH] Accept 'open' string in templated `auth` as authorized --- NEWS.md | 3 +++ lib/cartodb/template_maps.js | 4 ++++ test/unit/cartodb/template_maps_auth.test.js | 10 ++++++++++ 3 files changed, 17 insertions(+) diff --git a/NEWS.md b/NEWS.md index b313f2ac..5c5ec3f3 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,9 @@ 1.26.2 -- 2015-mm-dd -------------------- +Bugfixes: + - Accept 'open' string in templated `auth` as authorized. + 1.26.1 -- 2015-01-28 -------------------- diff --git a/lib/cartodb/template_maps.js b/lib/cartodb/template_maps.js index 14fae2e3..f103e59a 100644 --- a/lib/cartodb/template_maps.js +++ b/lib/cartodb/template_maps.js @@ -398,6 +398,10 @@ o.isAuthorized = function(template, authTokens) { return false; } + if (_.isString(templateAuth) && templateAuth === 'open') { + return true; + } + if (templateAuth.method === 'open') { return true; } diff --git a/test/unit/cartodb/template_maps_auth.test.js b/test/unit/cartodb/template_maps_auth.test.js index c01e841e..592e0257 100644 --- a/test/unit/cartodb/template_maps_auth.test.js +++ b/test/unit/cartodb/template_maps_auth.test.js @@ -92,4 +92,14 @@ suite('template_maps_auth', function() { }) }); + test("auth as 'open' string is authorized", function(done) { + var template = { + name: 'wadus_template', + auth: 'open' + }; + + assert.ok(templateMaps.isAuthorized(template)); + done(); + }); + });