diff --git a/client/expected/00_installation_test.out b/client/expected/00_installation_test.out index 50028dd..ee46a3f 100644 --- a/client/expected/00_installation_test.out +++ b/client/expected/00_installation_test.out @@ -33,4 +33,4 @@ CREATE SCHEMA cdb_geocoder_server; DROP ROLE IF EXISTS test_regular_user; CREATE ROLE test_regular_user; GRANT publicuser TO test_regular_user; -ALTER ROLE test_regular_user SET search_path TO "$user",public,cartodb,cdb_geocoder_client; +ALTER ROLE test_regular_user SET search_path TO public,cartodb,cdb_geocoder_client; diff --git a/client/expected/10_admin0_test.out b/client/expected/10_admin0_test.out index 13c532f..ac5c4d8 100644 --- a/client/expected/10_admin0_test.out +++ b/client/expected/10_admin0_test.out @@ -1,5 +1,5 @@ -- Add to the search path the schema -SET search_path TO "$user",public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_geocoder_client; -- Mock the server function CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_admin0_polygon(user_id name, user_config JSON, geocoder_config JSON, country_name text) RETURNS Geometry AS $$ diff --git a/client/expected/20_admin1_test.out b/client/expected/20_admin1_test.out index 7428868..190edf8 100644 --- a/client/expected/20_admin1_test.out +++ b/client/expected/20_admin1_test.out @@ -1,5 +1,5 @@ -- Add to the search path the schema -SET search_path TO "$user",public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_geocoder_client; -- Mock the server functions CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_admin1_polygon(user_id name, user_config JSON, geocoder_config JSON, admin1_name text) RETURNS Geometry AS $$ diff --git a/client/expected/30_namedplaces_test.out b/client/expected/30_namedplaces_test.out index 8470520..4f705a0 100644 --- a/client/expected/30_namedplaces_test.out +++ b/client/expected/30_namedplaces_test.out @@ -1,5 +1,5 @@ -- Add to the search path the schema -SET search_path TO "$user",public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_geocoder_client; -- Mock the server functions CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_namedplace_point(user_id name, user_config JSON, geocoder_config JSON, city_name text) RETURNS Geometry AS $$ diff --git a/client/expected/40_postalcodes_test.out b/client/expected/40_postalcodes_test.out index 00d052b..46d2c9c 100644 --- a/client/expected/40_postalcodes_test.out +++ b/client/expected/40_postalcodes_test.out @@ -1,5 +1,5 @@ -- Add to the search path the schema -SET search_path TO "$user",public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_geocoder_client; -- Mock the server functions CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_postalcode_polygon(user_id name, user_config JSON, geocoder_config JSON, postal_code text, country_name text) RETURNS Geometry AS $$ diff --git a/client/expected/50_ipaddresses_test.out b/client/expected/50_ipaddresses_test.out index a8cbbfd..a4ae569 100644 --- a/client/expected/50_ipaddresses_test.out +++ b/client/expected/50_ipaddresses_test.out @@ -1,5 +1,5 @@ -- Add to the search path the schema -SET search_path TO "$user",public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_geocoder_client; -- Mock the server functions CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_ipaddress_point(user_id name, user_config JSON, geocoder_config JSON, ip_address text) RETURNS Geometry AS $$ diff --git a/client/expected/90_permissions_test.out b/client/expected/90_permissions_test.out index 8b70706..4622cf4 100644 --- a/client/expected/90_permissions_test.out +++ b/client/expected/90_permissions_test.out @@ -1,7 +1,7 @@ -- Use regular user role SET ROLE test_regular_user; -- Add to the search path the schema -SET search_path TO "$user",public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_geocoder_client; -- Exercise the public function -- it is public, it shall work SELECT cdb_geocode_admin0_polygon('Spain'); diff --git a/client/sql/0.0.1/10_geocoder_server_conn.sql b/client/sql/0.0.1/10_geocoder_server_conn.sql index 387971f..5f3e1fc 100644 --- a/client/sql/0.0.1/10_geocoder_server_conn.sql +++ b/client/sql/0.0.1/10_geocoder_server_conn.sql @@ -13,4 +13,4 @@ BEGIN SELECT trim(both '"' FROM db_connection_str) INTO db_connection_str; RETURN db_connection_str; END; -$$ LANGUAGE 'plpgsql'; +$$ LANGUAGE 'plpgsql'; \ No newline at end of file diff --git a/client/sql/00_installation_test.sql b/client/sql/00_installation_test.sql index 29dbdcc..842299a 100644 --- a/client/sql/00_installation_test.sql +++ b/client/sql/00_installation_test.sql @@ -22,4 +22,4 @@ CREATE SCHEMA cdb_geocoder_server; DROP ROLE IF EXISTS test_regular_user; CREATE ROLE test_regular_user; GRANT publicuser TO test_regular_user; -ALTER ROLE test_regular_user SET search_path TO "$user",public,cartodb,cdb_geocoder_client; \ No newline at end of file +ALTER ROLE test_regular_user SET search_path TO public,cartodb,cdb_geocoder_client; \ No newline at end of file diff --git a/client/sql/10_admin0_test.sql b/client/sql/10_admin0_test.sql index f1ac039..6ca045c 100644 --- a/client/sql/10_admin0_test.sql +++ b/client/sql/10_admin0_test.sql @@ -1,5 +1,5 @@ -- Add to the search path the schema -SET search_path TO "$user",public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_geocoder_client; -- Mock the server function CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_admin0_polygon(user_id name, user_config JSON, geocoder_config JSON, country_name text) diff --git a/client/sql/20_admin1_test.sql b/client/sql/20_admin1_test.sql index fb130fc..55f34cc 100644 --- a/client/sql/20_admin1_test.sql +++ b/client/sql/20_admin1_test.sql @@ -1,5 +1,5 @@ -- Add to the search path the schema -SET search_path TO "$user",public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_geocoder_client; -- Mock the server functions CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_admin1_polygon(user_id name, user_config JSON, geocoder_config JSON, admin1_name text) diff --git a/client/sql/30_namedplaces_test.sql b/client/sql/30_namedplaces_test.sql index 491acc6..6b3cacc 100644 --- a/client/sql/30_namedplaces_test.sql +++ b/client/sql/30_namedplaces_test.sql @@ -1,5 +1,5 @@ -- Add to the search path the schema -SET search_path TO "$user",public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_geocoder_client; -- Mock the server functions CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_namedplace_point(user_id name, user_config JSON, geocoder_config JSON, city_name text) diff --git a/client/sql/40_postalcodes_test.sql b/client/sql/40_postalcodes_test.sql index 4c4a47d..e0c46c4 100644 --- a/client/sql/40_postalcodes_test.sql +++ b/client/sql/40_postalcodes_test.sql @@ -1,5 +1,5 @@ -- Add to the search path the schema -SET search_path TO "$user",public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_geocoder_client; -- Mock the server functions CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_postalcode_polygon(user_id name, user_config JSON, geocoder_config JSON, postal_code text, country_name text) diff --git a/client/sql/50_ipaddresses_test.sql b/client/sql/50_ipaddresses_test.sql index c4117df..1cb7472 100644 --- a/client/sql/50_ipaddresses_test.sql +++ b/client/sql/50_ipaddresses_test.sql @@ -1,5 +1,5 @@ -- Add to the search path the schema -SET search_path TO "$user",public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_geocoder_client; -- Mock the server functions CREATE OR REPLACE FUNCTION cdb_geocoder_server.cdb_geocode_ipaddress_point(user_id name, user_config JSON, geocoder_config JSON, ip_address text) diff --git a/client/sql/90_permissions_test.sql b/client/sql/90_permissions_test.sql index 3b05b79..9fcdebf 100644 --- a/client/sql/90_permissions_test.sql +++ b/client/sql/90_permissions_test.sql @@ -2,7 +2,7 @@ SET ROLE test_regular_user; -- Add to the search path the schema -SET search_path TO "$user",public,cartodb,cdb_geocoder_client; +SET search_path TO public,cartodb,cdb_geocoder_client; -- Exercise the public function -- it is public, it shall work diff --git a/client/templates/20_public_functions.erb b/client/templates/20_public_functions.erb index bb39a69..fe213f9 100644 --- a/client/templates/20_public_functions.erb +++ b/client/templates/20_public_functions.erb @@ -11,7 +11,7 @@ DECLARE user_config json; geocoder_config json; BEGIN - IF session_user = 'publicuser' THEN + IF session_user = 'publicuser' OR session_user ~ 'cartodb_publicuser_*' THEN RAISE EXCEPTION 'The api_key must be provided'; END IF; SELECT cartodb.CDB_Conf_GetConf('<%= user_config_key %>') INTO user_config;