Accept 'open' string in templated auth as authorized

This commit is contained in:
Raul Ochoa 2015-01-28 17:29:50 +01:00
parent ee1454d91c
commit efe090f5b0
3 changed files with 17 additions and 0 deletions

View File

@ -1,6 +1,9 @@
1.26.2 -- 2015-mm-dd 1.26.2 -- 2015-mm-dd
-------------------- --------------------
Bugfixes:
- Accept 'open' string in templated `auth` as authorized.
1.26.1 -- 2015-01-28 1.26.1 -- 2015-01-28
-------------------- --------------------

View File

@ -398,6 +398,10 @@ o.isAuthorized = function(template, authTokens) {
return false; return false;
} }
if (_.isString(templateAuth) && templateAuth === 'open') {
return true;
}
if (templateAuth.method === 'open') { if (templateAuth.method === 'open') {
return true; return true;
} }

View File

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