diff --git a/test/acceptance/auth/authorization.js b/test/acceptance/auth/authorization.js index b5ceadcb..4f13d0d0 100644 --- a/test/acceptance/auth/authorization.js +++ b/test/acceptance/auth/authorization.js @@ -207,4 +207,48 @@ describe('authorization', function() { testClient.drain(done); }); }); + + it('should create a layergroup with a buffer analysis using a regular apikey token', function (done) { + const apikeyToken = 'regular1'; + const mapConfig = { + version: '1.7.0', + layers: [ + { + type: 'cartodb', + options: { + source: { + id: 'HEAD1' + }, + cartocss: TestClient.CARTOCSS.POINTS, + cartocss_version: '2.3.0' + } + } + ], + analyses: [ + { + id: "HEAD1", + type: "buffer", + params: { + source: { + id: 'HEAD2', + type: 'source', + params: { + query: 'select * from test_table_localhost_regular1' + } + }, + radius: 50000 + } + } + ] + }; + const testClient = new TestClient(mapConfig, apikeyToken); + + testClient.getLayergroup(function (err, layergroupResult) { + assert.ifError(err); + + assert.ok(layergroupResult.layergroupid); + + testClient.drain(done); + }); + }); }); diff --git a/test/support/sql/windshaft.test.sql b/test/support/sql/windshaft.test.sql index 848c9c0a..2dd03160 100644 --- a/test/support/sql/windshaft.test.sql +++ b/test/support/sql/windshaft.test.sql @@ -27,6 +27,8 @@ CREATE USER :TESTUSER WITH PASSWORD ':TESTPASS'; DROP USER IF EXISTS test_windshaft_regular1; CREATE USER test_windshaft_regular1 WITH PASSWORD 'regular1'; +GRANT test_windshaft_regular1 to :TESTUSER; + -- first table CREATE TABLE test_table ( updated_at timestamp without time zone DEFAULT now(), @@ -193,6 +195,7 @@ INSERT INTO CDB_TableMetadata (tabname, updated_at) VALUES ('test_table_private_ -- GRANT SELECT ON CDB_TableMetadata TO :PUBLICUSER; GRANT SELECT ON CDB_TableMetadata TO :TESTUSER; +GRANT SELECT ON CDB_TableMetadata TO test_windshaft_regular1; -- for analysis -- long name table CREATE TABLE @@ -755,6 +758,7 @@ GRANT SELECT ON TABLE analysis_rent_listings TO :PUBLICUSER; -- GRANT SELECT, UPDATE, INSERT, DELETE ON cdb_analysis_catalog TO :TESTUSER; +GRANT SELECT, UPDATE, INSERT, DELETE ON cdb_analysis_catalog TO test_windshaft_regular1; -- for analysis DROP EXTENSION IF EXISTS crankshaft; CREATE SCHEMA IF NOT EXISTS cdb_crankshaft;