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(); + }); + });