Changed api key verifying to client instead of server

This commit is contained in:
Mario de Frutos 2015-11-24 12:25:43 +01:00
parent db72df95bf
commit 2b141452b4
12 changed files with 21 additions and 73 deletions

View File

@ -10,7 +10,7 @@ $$ LANGUAGE 'plpgsql';
SELECT cdb_geocoder_client.geocode_admin0_polygon('Spain');
NOTICE: cdb_geocoder_client._geocode_admin0_polygon(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_admin0_polygon invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, Spain)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_admin0_polygon(session_user, user_config, geocoder_config, country_name)"
PL/pgSQL function cdb_geocoder_client.geocode_admin0_polygon(text) line 9 at SQL statement
PL/pgSQL function cdb_geocoder_client.geocode_admin0_polygon(text) line 12 at SQL statement
geocode_admin0_polygon
------------------------

View File

@ -17,7 +17,7 @@ $$ LANGUAGE 'plpgsql';
SELECT cdb_geocoder_client.geocode_admin1_polygon('California');
NOTICE: cdb_geocoder_client._geocode_admin1_polygon(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_admin1_polygon invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, California)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_admin1_polygon(session_user, user_config, geocoder_config, admin1_name)"
PL/pgSQL function cdb_geocoder_client.geocode_admin1_polygon(text) line 9 at SQL statement
PL/pgSQL function cdb_geocoder_client.geocode_admin1_polygon(text) line 12 at SQL statement
geocode_admin1_polygon
------------------------
@ -26,7 +26,7 @@ PL/pgSQL function cdb_geocoder_client.geocode_admin1_polygon(text) line 9 at SQL
SELECT cdb_geocoder_client.geocode_admin1_polygon('California', 'United States');
NOTICE: cdb_geocoder_client._geocode_admin1_polygon(5): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_admin1_polygon invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, California, United States)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_admin1_polygon(session_user, user_config, geocoder_config, admin1_name, country_name)"
PL/pgSQL function cdb_geocoder_client.geocode_admin1_polygon(text,text) line 9 at SQL statement
PL/pgSQL function cdb_geocoder_client.geocode_admin1_polygon(text,text) line 12 at SQL statement
geocode_admin1_polygon
------------------------

View File

@ -24,7 +24,7 @@ $$ LANGUAGE 'plpgsql';
SELECT cdb_geocoder_client.geocode_namedplace_point('Elx');
NOTICE: cdb_geocoder_client._geocode_namedplace_point(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_namedplace_point invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, Elx)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_namedplace_point(session_user, user_config, geocoder_config, city_name)"
PL/pgSQL function cdb_geocoder_client.geocode_namedplace_point(text) line 9 at SQL statement
PL/pgSQL function cdb_geocoder_client.geocode_namedplace_point(text) line 12 at SQL statement
geocode_namedplace_point
--------------------------
@ -33,7 +33,7 @@ PL/pgSQL function cdb_geocoder_client.geocode_namedplace_point(text) line 9 at S
SELECT cdb_geocoder_client.geocode_namedplace_point('Elx', 'Spain');
NOTICE: cdb_geocoder_client._geocode_namedplace_point(5): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_namedplace_point invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, Elx, Spain)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_namedplace_point(session_user, user_config, geocoder_config, city_name, country_name)"
PL/pgSQL function cdb_geocoder_client.geocode_namedplace_point(text,text) line 9 at SQL statement
PL/pgSQL function cdb_geocoder_client.geocode_namedplace_point(text,text) line 12 at SQL statement
geocode_namedplace_point
--------------------------
@ -42,7 +42,7 @@ PL/pgSQL function cdb_geocoder_client.geocode_namedplace_point(text,text) line 9
SELECT cdb_geocoder_client.geocode_namedplace_point('Elx', 'Valencia', 'Spain');
NOTICE: cdb_geocoder_client._geocode_namedplace_point(6): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_namedplace_point invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, Elx, Valencia, Spain)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_namedplace_point(session_user, user_config, geocoder_config, city_name, admin1_name, country_name)"
PL/pgSQL function cdb_geocoder_client.geocode_namedplace_point(text,text,text) line 9 at SQL statement
PL/pgSQL function cdb_geocoder_client.geocode_namedplace_point(text,text,text) line 12 at SQL statement
geocode_namedplace_point
--------------------------

View File

@ -17,7 +17,7 @@ $$ LANGUAGE 'plpgsql';
SELECT cdb_geocoder_client.geocode_postalcode_polygon('03204', 'Spain');
NOTICE: cdb_geocoder_client._geocode_postalcode_polygon(5): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_postalcode_polygon invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, 03204, Spain)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_postalcode_polygon(session_user, user_config, geocoder_config, postal_code, country_name)"
PL/pgSQL function cdb_geocoder_client.geocode_postalcode_polygon(text,text) line 9 at SQL statement
PL/pgSQL function cdb_geocoder_client.geocode_postalcode_polygon(text,text) line 12 at SQL statement
geocode_postalcode_polygon
----------------------------
@ -26,7 +26,7 @@ PL/pgSQL function cdb_geocoder_client.geocode_postalcode_polygon(text,text) line
SELECT cdb_geocoder_client.geocode_postalcode_point('03204', 'Spain');
NOTICE: cdb_geocoder_client._geocode_postalcode_point(5): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_postalcode_point invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, 03204, Spain)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_postalcode_point(session_user, user_config, geocoder_config, postal_code, country_name)"
PL/pgSQL function cdb_geocoder_client.geocode_postalcode_point(text,text) line 9 at SQL statement
PL/pgSQL function cdb_geocoder_client.geocode_postalcode_point(text,text) line 12 at SQL statement
geocode_postalcode_point
--------------------------

View File

@ -10,7 +10,7 @@ $$ LANGUAGE 'plpgsql';
SELECT cdb_geocoder_client.geocode_ipaddress_point('8.8.8.8');
NOTICE: cdb_geocoder_client._geocode_ipaddress_point(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_ipaddress_point invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, 8.8.8.8)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_ipaddress_point(session_user, user_config, geocoder_config, ip_address)"
PL/pgSQL function cdb_geocoder_client.geocode_ipaddress_point(text) line 9 at SQL statement
PL/pgSQL function cdb_geocoder_client.geocode_ipaddress_point(text) line 12 at SQL statement
geocode_ipaddress_point
-------------------------

View File

@ -5,7 +5,7 @@ SET ROLE test_regular_user;
SELECT cdb_geocoder_client.geocode_admin0_polygon('Spain');
NOTICE: cdb_geocoder_client._geocode_admin0_polygon(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_admin0_polygon invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, Spain)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_admin0_polygon(session_user, user_config, geocoder_config, country_name)"
PL/pgSQL function cdb_geocoder_client.geocode_admin0_polygon(text) line 9 at SQL statement
PL/pgSQL function cdb_geocoder_client.geocode_admin0_polygon(text) line 12 at SQL statement
geocode_admin0_polygon
------------------------
@ -14,7 +14,7 @@ PL/pgSQL function cdb_geocoder_client.geocode_admin0_polygon(text) line 9 at SQL
SELECT cdb_geocoder_client.geocode_admin1_polygon('California');
NOTICE: cdb_geocoder_client._geocode_admin1_polygon(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_admin1_polygon invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, California)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_admin1_polygon(session_user, user_config, geocoder_config, admin1_name)"
PL/pgSQL function cdb_geocoder_client.geocode_admin1_polygon(text) line 9 at SQL statement
PL/pgSQL function cdb_geocoder_client.geocode_admin1_polygon(text) line 12 at SQL statement
geocode_admin1_polygon
------------------------
@ -23,7 +23,7 @@ PL/pgSQL function cdb_geocoder_client.geocode_admin1_polygon(text) line 9 at SQL
SELECT cdb_geocoder_client.geocode_admin1_polygon('California', 'United States');
NOTICE: cdb_geocoder_client._geocode_admin1_polygon(5): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_admin1_polygon invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, California, United States)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_admin1_polygon(session_user, user_config, geocoder_config, admin1_name, country_name)"
PL/pgSQL function cdb_geocoder_client.geocode_admin1_polygon(text,text) line 9 at SQL statement
PL/pgSQL function cdb_geocoder_client.geocode_admin1_polygon(text,text) line 12 at SQL statement
geocode_admin1_polygon
------------------------
@ -32,7 +32,7 @@ PL/pgSQL function cdb_geocoder_client.geocode_admin1_polygon(text,text) line 9 a
SELECT cdb_geocoder_client.geocode_namedplace_point('Elx');
NOTICE: cdb_geocoder_client._geocode_namedplace_point(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_namedplace_point invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, Elx)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_namedplace_point(session_user, user_config, geocoder_config, city_name)"
PL/pgSQL function cdb_geocoder_client.geocode_namedplace_point(text) line 9 at SQL statement
PL/pgSQL function cdb_geocoder_client.geocode_namedplace_point(text) line 12 at SQL statement
geocode_namedplace_point
--------------------------
@ -41,7 +41,7 @@ PL/pgSQL function cdb_geocoder_client.geocode_namedplace_point(text) line 9 at S
SELECT cdb_geocoder_client.geocode_namedplace_point('Elx', 'Valencia');
NOTICE: cdb_geocoder_client._geocode_namedplace_point(5): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_namedplace_point invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, Elx, Valencia)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_namedplace_point(session_user, user_config, geocoder_config, city_name, country_name)"
PL/pgSQL function cdb_geocoder_client.geocode_namedplace_point(text,text) line 9 at SQL statement
PL/pgSQL function cdb_geocoder_client.geocode_namedplace_point(text,text) line 12 at SQL statement
geocode_namedplace_point
--------------------------
@ -50,7 +50,7 @@ PL/pgSQL function cdb_geocoder_client.geocode_namedplace_point(text,text) line 9
SELECT cdb_geocoder_client.geocode_namedplace_point('Elx', 'Valencia', 'Spain');
NOTICE: cdb_geocoder_client._geocode_namedplace_point(6): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_namedplace_point invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, Elx, Valencia, Spain)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_namedplace_point(session_user, user_config, geocoder_config, city_name, admin1_name, country_name)"
PL/pgSQL function cdb_geocoder_client.geocode_namedplace_point(text,text,text) line 9 at SQL statement
PL/pgSQL function cdb_geocoder_client.geocode_namedplace_point(text,text,text) line 12 at SQL statement
geocode_namedplace_point
--------------------------
@ -59,7 +59,7 @@ PL/pgSQL function cdb_geocoder_client.geocode_namedplace_point(text,text,text) l
SELECT cdb_geocoder_client.geocode_postalcode_polygon('03204', 'Spain');
NOTICE: cdb_geocoder_client._geocode_postalcode_polygon(5): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_postalcode_polygon invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, 03204, Spain)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_postalcode_polygon(session_user, user_config, geocoder_config, postal_code, country_name)"
PL/pgSQL function cdb_geocoder_client.geocode_postalcode_polygon(text,text) line 9 at SQL statement
PL/pgSQL function cdb_geocoder_client.geocode_postalcode_polygon(text,text) line 12 at SQL statement
geocode_postalcode_polygon
----------------------------
@ -68,7 +68,7 @@ PL/pgSQL function cdb_geocoder_client.geocode_postalcode_polygon(text,text) line
SELECT cdb_geocoder_client.geocode_postalcode_point('03204', 'Spain');
NOTICE: cdb_geocoder_client._geocode_postalcode_point(5): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_postalcode_point invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, 03204, Spain)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_postalcode_point(session_user, user_config, geocoder_config, postal_code, country_name)"
PL/pgSQL function cdb_geocoder_client.geocode_postalcode_point(text,text) line 9 at SQL statement
PL/pgSQL function cdb_geocoder_client.geocode_postalcode_point(text,text) line 12 at SQL statement
geocode_postalcode_point
--------------------------
@ -77,7 +77,7 @@ PL/pgSQL function cdb_geocoder_client.geocode_postalcode_point(text,text) line 9
SELECT cdb_geocoder_client.geocode_ipaddress_point('8.8.8.8');
NOTICE: cdb_geocoder_client._geocode_ipaddress_point(4): [contrib_regression] REMOTE NOTICE: cdb_geocoder_server.geocode_ipaddress_point invoked with params (postgres, {"is_organization": false, "entity_name": "test_user"}, {"street_geocoder_provider": "nokia","nokia_monthly_quota": 100, "nokia_soft_geocoder_limit": false}, 8.8.8.8)
CONTEXT: SQL statement "SELECT cdb_geocoder_client._geocode_ipaddress_point(session_user, user_config, geocoder_config, ip_address)"
PL/pgSQL function cdb_geocoder_client.geocode_ipaddress_point(text) line 9 at SQL statement
PL/pgSQL function cdb_geocoder_client.geocode_ipaddress_point(text) line 12 at SQL statement
geocode_ipaddress_point
-------------------------

View File

@ -11,6 +11,9 @@ DECLARE
user_config json;
geocoder_config json;
BEGIN
IF session_user = 'publicuser' THEN
RAISE EXCEPTION 'The api_key must be provided';
END IF;
SELECT cartodb.CDB_Conf_GetConf('<%= user_config_key %>') INTO user_config;
SELECT cartodb.CDB_Conf_GetConf('<%= geocoder_config_key %>') INTO geocoder_config;
SELECT <%= GEOCODER_CLIENT_SCHEMA %>._<%= name %>(session_user, user_config, geocoder_config, <%= params %>) INTO ret;

View File

@ -5,11 +5,6 @@ RETURNS Geometry AS $$
plpy.debug('Entering geocode_admin0_polygons')
plpy.debug('user_id = %s' % user_id)
#-- Access control
#-- TODO: this should be part of cdb python library
if user_id == 'publicuser':
plpy.error('The api_key must be provided')
#--TODO: rate limiting check
#--TODO: quota check

View File

@ -6,11 +6,6 @@ RETURNS Geometry AS $$
plpy.debug('Entering geocode_admin1_polygon(admin1_name text)')
plpy.debug('user_id = %s' % user_id)
#-- Access control
#-- TODO: this should be part of cdb python library
if user_id == 'publicuser':
plpy.error('The api_key must be provided')
#--TODO: rate limiting check
#--TODO: quota check
@ -28,11 +23,6 @@ RETURNS Geometry AS $$
plpy.debug('Entering geocode_admin1_polygon(admin1_name text, country_name text)')
plpy.debug('user_id = %s' % user_id)
#-- Access control
#-- TODO: this should be part of cdb python library
if user_id == 'publicuser':
plpy.error('The api_key must be provided')
#--TODO: rate limiting check
#--TODO: quota check

View File

@ -6,11 +6,6 @@ RETURNS Geometry AS $$
plpy.debug('Entering geocode_namedplace_point(city_name text)')
plpy.debug('user_id = %s' % user_id)
#-- Access control
#-- TODO: this should be part of cdb python library
if user_id == 'publicuser':
plpy.error('The api_key must be provided')
#--TODO: rate limiting check
#--TODO: quota check
@ -28,11 +23,6 @@ RETURNS Geometry AS $$
plpy.debug('Entering geocode_namedplace_point(city_name text, country_name text)')
plpy.debug('user_id = %s' % user_id)
#-- Access control
#-- TODO: this should be part of cdb python library
if user_id == 'publicuser':
plpy.error('The api_key must be provided')
#--TODO: rate limiting check
#--TODO: quota check
@ -50,11 +40,6 @@ RETURNS Geometry AS $$
plpy.debug('Entering geocode_namedplace_point(city_name text, admin1_name text, country_name text)')
plpy.debug('user_id = %s' % user_id)
#-- Access control
#-- TODO: this should be part of cdb python library
if user_id == 'publicuser':
plpy.error('The api_key must be provided')
#--TODO: rate limiting check
#--TODO: quota check

View File

@ -7,11 +7,6 @@ RETURNS Geometry AS $$
plpy.debug('Entering _geocode_postalcode_point')
plpy.debug('user_id = %s' % user_id)
#-- Access control
#-- TODO: this should be part of cdb python library
if user_id == 'publicuser':
plpy.error('The api_key must be provided')
#--TODO: rate limiting check
#--TODO: quota check
@ -28,11 +23,6 @@ RETURNS Geometry AS $$
plpy.debug('Entering _geocode_postalcode_point')
plpy.debug('user_id = %s' % user_id)
#-- Access control
#-- TODO: this should be part of cdb python library
if user_id == 'publicuser':
plpy.error('The api_key must be provided')
#--TODO: rate limiting check
#--TODO: quota check
@ -49,11 +39,6 @@ RETURNS Geometry AS $$
plpy.debug('Entering _geocode_postalcode_polygon')
plpy.debug('user_id = %s' % user_id)
#-- Access control
#-- TODO: this should be part of cdb python library
if user_id == 'publicuser':
plpy.error('The api_key must be provided')
#--TODO: rate limiting check
#--TODO: quota check
@ -70,11 +55,6 @@ RETURNS Geometry AS $$
plpy.debug('Entering _geocode_postalcode_point')
plpy.debug('user_id = %s' % user_id)
#-- Access control
#-- TODO: this should be part of cdb python library
if user_id == 'publicuser':
plpy.error('The api_key must be provided')
#--TODO: rate limiting check
#--TODO: quota check

View File

@ -5,11 +5,6 @@ RETURNS Geometry AS $$
plpy.debug('Entering _geocode_ipaddress_point')
plpy.debug('user_id = %s' % user_id)
#-- Access control
#-- TODO: this should be part of cdb python library
if user_id == 'publicuser':
plpy.error('The api_key must be provided')
#--TODO: rate limiting check
#--TODO: quota check