Added the organization public user to the api key check

This commit is contained in:
Mario de Frutos 2015-11-27 13:20:55 +01:00
parent dda83c0976
commit 06f033b72a
16 changed files with 16 additions and 16 deletions

View File

@ -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;

View File

@ -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 $$

View File

@ -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 $$

View File

@ -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 $$

View File

@ -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 $$

View File

@ -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 $$

View File

@ -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');

View File

@ -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;
ALTER ROLE test_regular_user SET search_path TO public,cartodb,cdb_geocoder_client;

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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;