Changed error message

This commit is contained in:
antoniocarlon 2018-09-10 16:45:31 +02:00
parent f4cb9ba812
commit 08daa6a6a2
13 changed files with 104 additions and 104 deletions

View File

@ -3,7 +3,7 @@
return_type: Geometry return_type: Geometry
requires_permission: true requires_permission: true
permission_name: geocoding permission_name: geocoding
permission_error: Geocoding is not allowed permission_error: Geocoding permission denied
params: params:
- { name: country_name, type: text } - { name: country_name, type: text }
@ -11,7 +11,7 @@
return_type: Geometry return_type: Geometry
requires_permission: true requires_permission: true
permission_name: geocoding permission_name: geocoding
permission_error: Geocoding is not allowed permission_error: Geocoding permission denied
params: params:
- { name: admin1_name, type: text } - { name: admin1_name, type: text }
@ -19,7 +19,7 @@
return_type: Geometry return_type: Geometry
requires_permission: true requires_permission: true
permission_name: geocoding permission_name: geocoding
permission_error: Geocoding is not allowed permission_error: Geocoding permission denied
params: params:
- { name: admin1_name, type: text } - { name: admin1_name, type: text }
- { name: country_name, type: text } - { name: country_name, type: text }
@ -28,7 +28,7 @@
return_type: Geometry return_type: Geometry
requires_permission: true requires_permission: true
permission_name: geocoding permission_name: geocoding
permission_error: Geocoding is not allowed permission_error: Geocoding permission denied
params: params:
- { name: city_name, type: text} - { name: city_name, type: text}
@ -36,7 +36,7 @@
return_type: Geometry return_type: Geometry
requires_permission: true requires_permission: true
permission_name: geocoding permission_name: geocoding
permission_error: Geocoding is not allowed permission_error: Geocoding permission denied
params: params:
- { name: city_name, type: text} - { name: city_name, type: text}
- { name: country_name, type: text} - { name: country_name, type: text}
@ -45,7 +45,7 @@
return_type: Geometry return_type: Geometry
requires_permission: true requires_permission: true
permission_name: geocoding permission_name: geocoding
permission_error: Geocoding is not allowed permission_error: Geocoding permission denied
params: params:
- { name: city_name, type: text} - { name: city_name, type: text}
- { name: admin1_name, type: text} - { name: admin1_name, type: text}
@ -55,7 +55,7 @@
return_type: Geometry return_type: Geometry
requires_permission: true requires_permission: true
permission_name: geocoding permission_name: geocoding
permission_error: Geocoding is not allowed permission_error: Geocoding permission denied
params: params:
- { name: postal_code, type: text} - { name: postal_code, type: text}
- { name: country_name, type: text} - { name: country_name, type: text}
@ -64,7 +64,7 @@
return_type: Geometry return_type: Geometry
requires_permission: true requires_permission: true
permission_name: geocoding permission_name: geocoding
permission_error: Geocoding is not allowed permission_error: Geocoding permission denied
params: params:
- { name: postal_code, type: double precision} - { name: postal_code, type: double precision}
- { name: country_name, type: text} - { name: country_name, type: text}
@ -73,7 +73,7 @@
return_type: Geometry return_type: Geometry
requires_permission: true requires_permission: true
permission_name: geocoding permission_name: geocoding
permission_error: Geocoding is not allowed permission_error: Geocoding permission denied
params: params:
- { name: postal_code, type: text} - { name: postal_code, type: text}
- { name: country_name, type: text} - { name: country_name, type: text}
@ -82,7 +82,7 @@
return_type: Geometry return_type: Geometry
requires_permission: true requires_permission: true
permission_name: geocoding permission_name: geocoding
permission_error: Geocoding is not allowed permission_error: Geocoding permission denied
params: params:
- { name: postal_code, type: double precision} - { name: postal_code, type: double precision}
- { name: country_name, type: text} - { name: country_name, type: text}
@ -91,7 +91,7 @@
return_type: Geometry return_type: Geometry
requires_permission: true requires_permission: true
permission_name: geocoding permission_name: geocoding
permission_error: Geocoding is not allowed permission_error: Geocoding permission denied
params: params:
- { name: ip_address, type: text} - { name: ip_address, type: text}
@ -99,7 +99,7 @@
return_type: Geometry return_type: Geometry
requires_permission: true requires_permission: true
permission_name: geocoding permission_name: geocoding
permission_error: Geocoding is not allowed permission_error: Geocoding permission denied
params: params:
- { name: searchtext, type: text} - { name: searchtext, type: text}
- { name: city, type: text, default: 'NULL'} - { name: city, type: text, default: 'NULL'}
@ -112,7 +112,7 @@
multi_field: true multi_field: true
requires_permission: true requires_permission: true
permission_name: geocoding permission_name: geocoding
permission_error: Geocoding is not allowed permission_error: Geocoding permission denied
params: params:
- { name: searches, type: jsonb } # Array of JSON objects with id, address, city, state and country fields - { name: searches, type: jsonb } # Array of JSON objects with id, address, city, state and country fields
@ -120,7 +120,7 @@
return_type: Geometry return_type: Geometry
requires_permission: true requires_permission: true
permission_name: geocoding permission_name: geocoding
permission_error: Geocoding is not allowed permission_error: Geocoding permission denied
params: params:
- { name: searchtext, type: text} - { name: searchtext, type: text}
- { name: city, type: text, default: 'NULL'} - { name: city, type: text, default: 'NULL'}
@ -131,7 +131,7 @@
return_type: Geometry return_type: Geometry
requires_permission: true requires_permission: true
permission_name: geocoding permission_name: geocoding
permission_error: Geocoding is not allowed permission_error: Geocoding permission denied
params: params:
- { name: searchtext, type: text} - { name: searchtext, type: text}
- { name: city, type: text, default: 'NULL'} - { name: city, type: text, default: 'NULL'}
@ -142,7 +142,7 @@
return_type: Geometry return_type: Geometry
requires_permission: true requires_permission: true
permission_name: geocoding permission_name: geocoding
permission_error: Geocoding is not allowed permission_error: Geocoding permission denied
params: params:
- { name: searchtext, type: text} - { name: searchtext, type: text}
- { name: city, type: text, default: 'NULL'} - { name: city, type: text, default: 'NULL'}
@ -153,7 +153,7 @@
return_type: Geometry return_type: Geometry
requires_permission: true requires_permission: true
permission_name: geocoding permission_name: geocoding
permission_error: Geocoding is not allowed permission_error: Geocoding permission denied
params: params:
- { name: searchtext, type: text} - { name: searchtext, type: text}
- { name: city, type: text, default: 'NULL'} - { name: city, type: text, default: 'NULL'}
@ -164,7 +164,7 @@
return_type: Geometry return_type: Geometry
requires_permission: true requires_permission: true
permission_name: geocoding permission_name: geocoding
permission_error: Geocoding is not allowed permission_error: Geocoding permission denied
params: params:
- { name: searchtext, type: text} - { name: searchtext, type: text}
- { name: city, type: text, default: 'NULL'} - { name: city, type: text, default: 'NULL'}
@ -280,7 +280,7 @@
multi_field: true multi_field: true
requires_permission: true requires_permission: true
permission_name: routing permission_name: routing
permission_error: Routing is not allowed permission_error: Routing permission denied
params: params:
- { name: origin, type: "geometry(Point, 4326)" } - { name: origin, type: "geometry(Point, 4326)" }
- { name: destination, type: "geometry(Point, 4326)" } - { name: destination, type: "geometry(Point, 4326)" }
@ -293,7 +293,7 @@
multi_field: true multi_field: true
requires_permission: true requires_permission: true
permission_name: routing permission_name: routing
permission_error: Routing is not allowed permission_error: Routing permission denied
params: params:
- { name: waypoints, type: "geometry(Point, 4326)[]" } - { name: waypoints, type: "geometry(Point, 4326)[]" }
- { name: mode, type: text } - { name: mode, type: text }

View File

@ -16,9 +16,9 @@ BEGIN
END IF; END IF;
<% unless superuser_function? -%>SELECT u, o, p INTO username, orgname, apikey_permissions FROM cdb_dataservices_client._cdb_entity_config() AS (u text, o text, p json); <% unless superuser_function? -%>SELECT u, o, p INTO username, orgname, apikey_permissions FROM cdb_dataservices_client._cdb_entity_config() AS (u text, o text, p json);
<% if requires_permission %>IF apikey_permissions IS NULL OR NOT apikey_permissions::jsonb ? '<%= permission_name %>' THEN <% if requires_permission %>IF apikey_permissions IS NULL OR NOT apikey_permissions::jsonb ? '<%= permission_name %>' THEN
RAISE EXCEPTION '<%= permission_error %>'; RAISE EXCEPTION '<%= permission_error %>' USING ERRCODE = 'CDB403';
END IF; END IF;<% end %>
<% else %>SELECT u, o INTO username, orgname FROM <%= DATASERVICES_CLIENT_SCHEMA %>._cdb_entity_config() AS (u text, o text, p json);<% end %><% end %> <% else %>SELECT u, o INTO username, orgname FROM <%= DATASERVICES_CLIENT_SCHEMA %>._cdb_entity_config() AS (u text, o text, p json);<% end %>
-- JSON value stored "" is taken as literal -- JSON value stored "" is taken as literal
IF username IS NULL OR username = '' OR username = '""' THEN IF username IS NULL OR username = '' OR username = '""' THEN
RAISE EXCEPTION 'Username is a mandatory argument, check it out'; RAISE EXCEPTION 'Username is a mandatory argument, check it out';

View File

@ -22,7 +22,7 @@ BEGIN
END IF; END IF;
SELECT u, o, p INTO username, orgname, apikey_permissions FROM cdb_dataservices_client._cdb_entity_config() AS (u text, o text, p json); SELECT u, o, p INTO username, orgname, apikey_permissions FROM cdb_dataservices_client._cdb_entity_config() AS (u text, o text, p json);
IF apikey_permissions IS NULL OR NOT apikey_permissions::jsonb ? 'geocoding' THEN IF apikey_permissions IS NULL OR NOT apikey_permissions::jsonb ? 'geocoding' THEN
RAISE EXCEPTION 'Geocoding is not allowed'; RAISE EXCEPTION 'Geocoding permission denied';
END IF; END IF;
-- JSON value stored "" is taken as literal -- JSON value stored "" is taken as literal

View File

@ -12,7 +12,7 @@ $$ LANGUAGE 'plpgsql';
-- -- Exercise the public and the proxied function -- -- Exercise the public and the proxied function
-- No permissions granted -- No permissions granted
SELECT cdb_geocode_admin0_polygon('Spain'); SELECT cdb_geocode_admin0_polygon('Spain');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
-- Grant other permissions but geocoding -- Grant other permissions but geocoding
SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing", "isolines"]}'); SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing", "isolines"]}');
cdb_conf_setconf cdb_conf_setconf
@ -21,7 +21,7 @@ SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing", "isoli
(1 row) (1 row)
SELECT cdb_geocode_admin0_polygon('Spain'); SELECT cdb_geocode_admin0_polygon('Spain');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
-- Grant geocoding permissions -- Grant geocoding permissions
SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["geocoding"]}'); SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["geocoding"]}');
cdb_conf_setconf cdb_conf_setconf

View File

@ -19,9 +19,9 @@ $$ LANGUAGE 'plpgsql';
-- -- Exercise the public and the proxied function -- -- Exercise the public and the proxied function
-- No permissions granted -- No permissions granted
SELECT cdb_geocode_admin1_polygon('California'); SELECT cdb_geocode_admin1_polygon('California');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_admin1_polygon('California', 'United States'); SELECT cdb_geocode_admin1_polygon('California', 'United States');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
-- Grant other permissions but geocoding -- Grant other permissions but geocoding
SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing", "isolines"]}'); SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing", "isolines"]}');
cdb_conf_setconf cdb_conf_setconf
@ -30,9 +30,9 @@ SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing", "isoli
(1 row) (1 row)
SELECT cdb_geocode_admin1_polygon('California'); SELECT cdb_geocode_admin1_polygon('California');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_admin1_polygon('California', 'United States'); SELECT cdb_geocode_admin1_polygon('California', 'United States');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
-- Grant geocoding permissions -- Grant geocoding permissions
SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["geocoding"]}'); SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["geocoding"]}');
cdb_conf_setconf cdb_conf_setconf

View File

@ -12,10 +12,10 @@ $$ LANGUAGE SQL;
-- No permissions granted -- No permissions granted
-- Test bulk size not mandatory (it will get the optimal) -- Test bulk size not mandatory (it will get the optimal)
SELECT cdb_dataservices_client.cdb_bulk_geocode_street_point('select 1 as cartodb_id', '''Valladolid, Spain''', null, null, null, null); SELECT cdb_dataservices_client.cdb_bulk_geocode_street_point('select 1 as cartodb_id', '''Valladolid, Spain''', null, null, null, null);
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
-- Test quota check by mocking quota 0 -- Test quota check by mocking quota 0
SELECT cdb_dataservices_client.cdb_bulk_geocode_street_point('select 1 as cartodb_id', '''Valladolid, Spain'''); SELECT cdb_dataservices_client.cdb_bulk_geocode_street_point('select 1 as cartodb_id', '''Valladolid, Spain''');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
-- Grant other permissions but geocoding -- Grant other permissions but geocoding
SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing", "isolines"]}'); SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing", "isolines"]}');
cdb_conf_setconf cdb_conf_setconf
@ -25,10 +25,10 @@ SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing", "isoli
-- Test bulk size not mandatory (it will get the optimal) -- Test bulk size not mandatory (it will get the optimal)
SELECT cdb_dataservices_client.cdb_bulk_geocode_street_point('select 1 as cartodb_id', '''Valladolid, Spain''', null, null, null, null); SELECT cdb_dataservices_client.cdb_bulk_geocode_street_point('select 1 as cartodb_id', '''Valladolid, Spain''', null, null, null, null);
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
-- Test quota check by mocking quota 0 -- Test quota check by mocking quota 0
SELECT cdb_dataservices_client.cdb_bulk_geocode_street_point('select 1 as cartodb_id', '''Valladolid, Spain'''); SELECT cdb_dataservices_client.cdb_bulk_geocode_street_point('select 1 as cartodb_id', '''Valladolid, Spain''');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
-- Grant geocoding permissions -- Grant geocoding permissions
SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["geocoding"]}'); SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["geocoding"]}');
cdb_conf_setconf cdb_conf_setconf

View File

@ -31,11 +31,11 @@ $$ LANGUAGE 'plpgsql';
-- No permissions granted -- No permissions granted
SET ROLE test_regular_user; -- Use regular user role SET ROLE test_regular_user; -- Use regular user role
SELECT _cdb_geocode_street_point_exception_safe('One street, 1'); SELECT _cdb_geocode_street_point_exception_safe('One street, 1');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT * FROM _cdb_isodistance_exception_safe('POINT(-3.70568 40.42028)'::geometry, 'walk', ARRAY[300]::integer[]); SELECT * FROM _cdb_isodistance_exception_safe('POINT(-3.70568 40.42028)'::geometry, 'walk', ARRAY[300]::integer[]);
ERROR: Isolines are not allowed ERROR: Isolines are not allowed
SELECT * FROM _cdb_route_point_to_point_exception_safe('POINT(-3.70237112 40.41706163)'::geometry,'POINT(-3.69909883 40.41236875)'::geometry, 'car', ARRAY['mode_type=shortest']::text[]); SELECT * FROM _cdb_route_point_to_point_exception_safe('POINT(-3.70237112 40.41706163)'::geometry,'POINT(-3.69909883 40.41236875)'::geometry, 'car', ARRAY['mode_type=shortest']::text[]);
ERROR: Routing is not allowed ERROR: Routing permission denied
-- No permissions granted but conf created -- No permissions granted but conf created
SET ROLE postgres; SET ROLE postgres;
SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": []}'); SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": []}');
@ -46,11 +46,11 @@ SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": []}');
SET ROLE test_regular_user; -- Use regular user role SET ROLE test_regular_user; -- Use regular user role
SELECT _cdb_geocode_street_point_exception_safe('One street, 1'); SELECT _cdb_geocode_street_point_exception_safe('One street, 1');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT * FROM _cdb_isodistance_exception_safe('POINT(-3.70568 40.42028)'::geometry, 'walk', ARRAY[300]::integer[]); SELECT * FROM _cdb_isodistance_exception_safe('POINT(-3.70568 40.42028)'::geometry, 'walk', ARRAY[300]::integer[]);
ERROR: Isolines are not allowed ERROR: Isolines are not allowed
SELECT * FROM _cdb_route_point_to_point_exception_safe('POINT(-3.70237112 40.41706163)'::geometry,'POINT(-3.69909883 40.41236875)'::geometry, 'car', ARRAY['mode_type=shortest']::text[]); SELECT * FROM _cdb_route_point_to_point_exception_safe('POINT(-3.70237112 40.41706163)'::geometry,'POINT(-3.69909883 40.41236875)'::geometry, 'car', ARRAY['mode_type=shortest']::text[]);
ERROR: Routing is not allowed ERROR: Routing permission denied
-- Grant geocoding permissions -- Grant geocoding permissions
SET ROLE postgres; SET ROLE postgres;
SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["geocoding", "routing", "isolines"]}'); SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["geocoding", "routing", "isolines"]}');

View File

@ -26,11 +26,11 @@ $$ LANGUAGE 'plpgsql';
-- -- Exercise the public and the proxied function -- -- Exercise the public and the proxied function
-- No permissions granted -- No permissions granted
SELECT cdb_geocode_namedplace_point('Elx'); SELECT cdb_geocode_namedplace_point('Elx');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_namedplace_point('Elx', 'Spain'); SELECT cdb_geocode_namedplace_point('Elx', 'Spain');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_namedplace_point('Elx', 'Valencia', 'Spain'); SELECT cdb_geocode_namedplace_point('Elx', 'Valencia', 'Spain');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
-- Grant other permissions but geocoding -- Grant other permissions but geocoding
SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing", "isolines"]}'); SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing", "isolines"]}');
cdb_conf_setconf cdb_conf_setconf
@ -39,11 +39,11 @@ SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing", "isoli
(1 row) (1 row)
SELECT cdb_geocode_namedplace_point('Elx'); SELECT cdb_geocode_namedplace_point('Elx');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_namedplace_point('Elx', 'Spain'); SELECT cdb_geocode_namedplace_point('Elx', 'Spain');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_namedplace_point('Elx', 'Valencia', 'Spain'); SELECT cdb_geocode_namedplace_point('Elx', 'Valencia', 'Spain');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
-- Grant geocoding permissions -- Grant geocoding permissions
SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["geocoding"]}'); SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["geocoding"]}');
cdb_conf_setconf cdb_conf_setconf

View File

@ -19,9 +19,9 @@ $$ LANGUAGE 'plpgsql';
-- -- Exercise the public and the proxied function -- -- Exercise the public and the proxied function
-- No permissions granted -- No permissions granted
SELECT cdb_geocode_postalcode_polygon('03204', 'Spain'); SELECT cdb_geocode_postalcode_polygon('03204', 'Spain');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_postalcode_point('03204', 'Spain'); SELECT cdb_geocode_postalcode_point('03204', 'Spain');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
-- Grant other permissions but geocoding -- Grant other permissions but geocoding
SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing", "isolines"]}'); SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing", "isolines"]}');
cdb_conf_setconf cdb_conf_setconf
@ -30,9 +30,9 @@ SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing", "isoli
(1 row) (1 row)
SELECT cdb_geocode_postalcode_polygon('03204', 'Spain'); SELECT cdb_geocode_postalcode_polygon('03204', 'Spain');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_postalcode_point('03204', 'Spain'); SELECT cdb_geocode_postalcode_point('03204', 'Spain');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
-- Grant geocoding permissions -- Grant geocoding permissions
SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["geocoding"]}'); SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["geocoding"]}');
cdb_conf_setconf cdb_conf_setconf

View File

@ -12,7 +12,7 @@ $$ LANGUAGE 'plpgsql';
-- -- Exercise the public and the proxied function -- -- Exercise the public and the proxied function
-- No permissions granted -- No permissions granted
SELECT cdb_geocode_ipaddress_point('8.8.8.8'); SELECT cdb_geocode_ipaddress_point('8.8.8.8');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
-- Grant other permissions but geocoding -- Grant other permissions but geocoding
SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing", "isolines"]}'); SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing", "isolines"]}');
cdb_conf_setconf cdb_conf_setconf
@ -21,7 +21,7 @@ SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing", "isoli
(1 row) (1 row)
SELECT cdb_geocode_ipaddress_point('8.8.8.8'); SELECT cdb_geocode_ipaddress_point('8.8.8.8');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
-- Grant geocoding permissions -- Grant geocoding permissions
SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["geocoding"]}'); SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["geocoding"]}');
cdb_conf_setconf cdb_conf_setconf

View File

@ -12,25 +12,25 @@ $$ LANGUAGE 'plpgsql';
-- -- Exercise the public and the proxied function -- -- Exercise the public and the proxied function
-- No permissions granted -- No permissions granted
SELECT cdb_geocode_street_point('One street, 1'); SELECT cdb_geocode_street_point('One street, 1');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_street_point('One street', 'city'); SELECT cdb_geocode_street_point('One street', 'city');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_street_point('One street', 'city', 'state'); SELECT cdb_geocode_street_point('One street', 'city', 'state');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_street_point('One street', 'city', 'state', 'country'); SELECT cdb_geocode_street_point('One street', 'city', 'state', 'country');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_street_point('One street', 'city', NULL, 'country'); SELECT cdb_geocode_street_point('One street', 'city', NULL, 'country');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_street_point('One street, 1'); SELECT cdb_geocode_street_point('One street, 1');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_street_point('One street', 'city'); SELECT cdb_geocode_street_point('One street', 'city');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_street_point('One street', 'city', 'state'); SELECT cdb_geocode_street_point('One street', 'city', 'state');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_street_point('One street', 'city', 'state', 'country'); SELECT cdb_geocode_street_point('One street', 'city', 'state', 'country');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_street_point('One street', 'city', NULL, 'country'); SELECT cdb_geocode_street_point('One street', 'city', NULL, 'country');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
-- Grant other permissions but geocoding -- Grant other permissions but geocoding
SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing", "isolines"]}'); SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing", "isolines"]}');
cdb_conf_setconf cdb_conf_setconf
@ -39,25 +39,25 @@ SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing", "isoli
(1 row) (1 row)
SELECT cdb_geocode_street_point('One street, 1'); SELECT cdb_geocode_street_point('One street, 1');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_street_point('One street', 'city'); SELECT cdb_geocode_street_point('One street', 'city');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_street_point('One street', 'city', 'state'); SELECT cdb_geocode_street_point('One street', 'city', 'state');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_street_point('One street', 'city', 'state', 'country'); SELECT cdb_geocode_street_point('One street', 'city', 'state', 'country');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_street_point('One street', 'city', NULL, 'country'); SELECT cdb_geocode_street_point('One street', 'city', NULL, 'country');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_street_point('One street, 1'); SELECT cdb_geocode_street_point('One street, 1');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_street_point('One street', 'city'); SELECT cdb_geocode_street_point('One street', 'city');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_street_point('One street', 'city', 'state'); SELECT cdb_geocode_street_point('One street', 'city', 'state');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_street_point('One street', 'city', 'state', 'country'); SELECT cdb_geocode_street_point('One street', 'city', 'state', 'country');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_street_point('One street', 'city', NULL, 'country'); SELECT cdb_geocode_street_point('One street', 'city', NULL, 'country');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
-- Grant geocoding permissions -- Grant geocoding permissions
SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["geocoding"]}'); SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["geocoding"]}');
cdb_conf_setconf cdb_conf_setconf

View File

@ -25,17 +25,17 @@ $$ LANGUAGE 'plpgsql';
-- -- Exercise the public and the proxied function -- -- Exercise the public and the proxied function
-- No permissions granted -- No permissions granted
SELECT cdb_route_point_to_point('POINT(-87.81406 41.89308)'::geometry,'POINT(-87.79209 41.86138)'::geometry, 'car'); SELECT cdb_route_point_to_point('POINT(-87.81406 41.89308)'::geometry,'POINT(-87.79209 41.86138)'::geometry, 'car');
ERROR: Routing is not allowed ERROR: Routing permission denied
SELECT cdb_route_point_to_point('POINT(-87.81406 41.89308)'::geometry,'POINT(-87.79209 41.86138)'::geometry, 'car', ARRAY['mode_type=shortest']::text[]); SELECT cdb_route_point_to_point('POINT(-87.81406 41.89308)'::geometry,'POINT(-87.79209 41.86138)'::geometry, 'car', ARRAY['mode_type=shortest']::text[]);
ERROR: Routing is not allowed ERROR: Routing permission denied
SELECT cdb_route_point_to_point('POINT(-87.81406 41.89308)'::geometry,'POINT(-87.79209 41.86138)'::geometry, 'car', ARRAY[]::text[], 'miles'); SELECT cdb_route_point_to_point('POINT(-87.81406 41.89308)'::geometry,'POINT(-87.79209 41.86138)'::geometry, 'car', ARRAY[]::text[], 'miles');
ERROR: Routing is not allowed ERROR: Routing permission denied
SELECT cdb_route_with_waypoints(Array['POINT(-87.81406 41.89308)'::geometry,'POINT(-87.80406 41.87308)'::geometry,'POINT(-87.79209 41.86138)'::geometry], 'car'); SELECT cdb_route_with_waypoints(Array['POINT(-87.81406 41.89308)'::geometry,'POINT(-87.80406 41.87308)'::geometry,'POINT(-87.79209 41.86138)'::geometry], 'car');
ERROR: Routing is not allowed ERROR: Routing permission denied
SELECT cdb_route_with_waypoints(Array['POINT(-87.81406 41.89308)'::geometry,'POINT(-87.80406 41.87308)'::geometry,'POINT(-87.79209 41.86138)'::geometry], 'car', ARRAY['mode_type=shortest']::text[]); SELECT cdb_route_with_waypoints(Array['POINT(-87.81406 41.89308)'::geometry,'POINT(-87.80406 41.87308)'::geometry,'POINT(-87.79209 41.86138)'::geometry], 'car', ARRAY['mode_type=shortest']::text[]);
ERROR: Routing is not allowed ERROR: Routing permission denied
SELECT cdb_route_with_waypoints(Array['POINT(-87.81406 41.89308)'::geometry,'POINT(-87.80406 41.87308)'::geometry,'POINT(-87.79209 41.86138)'::geometry], 'car', ARRAY[]::text[], 'miles'); SELECT cdb_route_with_waypoints(Array['POINT(-87.81406 41.89308)'::geometry,'POINT(-87.80406 41.87308)'::geometry,'POINT(-87.79209 41.86138)'::geometry], 'car', ARRAY[]::text[], 'miles');
ERROR: Routing is not allowed ERROR: Routing permission denied
-- Grant other permissions but routing -- Grant other permissions but routing
SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["geocoding", "isolines"]}'); SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["geocoding", "isolines"]}');
cdb_conf_setconf cdb_conf_setconf
@ -44,17 +44,17 @@ SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["geocoding", "iso
(1 row) (1 row)
SELECT cdb_route_point_to_point('POINT(-87.81406 41.89308)'::geometry,'POINT(-87.79209 41.86138)'::geometry, 'car'); SELECT cdb_route_point_to_point('POINT(-87.81406 41.89308)'::geometry,'POINT(-87.79209 41.86138)'::geometry, 'car');
ERROR: Routing is not allowed ERROR: Routing permission denied
SELECT cdb_route_point_to_point('POINT(-87.81406 41.89308)'::geometry,'POINT(-87.79209 41.86138)'::geometry, 'car', ARRAY['mode_type=shortest']::text[]); SELECT cdb_route_point_to_point('POINT(-87.81406 41.89308)'::geometry,'POINT(-87.79209 41.86138)'::geometry, 'car', ARRAY['mode_type=shortest']::text[]);
ERROR: Routing is not allowed ERROR: Routing permission denied
SELECT cdb_route_point_to_point('POINT(-87.81406 41.89308)'::geometry,'POINT(-87.79209 41.86138)'::geometry, 'car', ARRAY[]::text[], 'miles'); SELECT cdb_route_point_to_point('POINT(-87.81406 41.89308)'::geometry,'POINT(-87.79209 41.86138)'::geometry, 'car', ARRAY[]::text[], 'miles');
ERROR: Routing is not allowed ERROR: Routing permission denied
SELECT cdb_route_with_waypoints(Array['POINT(-87.81406 41.89308)'::geometry,'POINT(-87.80406 41.87308)'::geometry,'POINT(-87.79209 41.86138)'::geometry], 'car'); SELECT cdb_route_with_waypoints(Array['POINT(-87.81406 41.89308)'::geometry,'POINT(-87.80406 41.87308)'::geometry,'POINT(-87.79209 41.86138)'::geometry], 'car');
ERROR: Routing is not allowed ERROR: Routing permission denied
SELECT cdb_route_with_waypoints(Array['POINT(-87.81406 41.89308)'::geometry,'POINT(-87.80406 41.87308)'::geometry,'POINT(-87.79209 41.86138)'::geometry], 'car', ARRAY['mode_type=shortest']::text[]); SELECT cdb_route_with_waypoints(Array['POINT(-87.81406 41.89308)'::geometry,'POINT(-87.80406 41.87308)'::geometry,'POINT(-87.79209 41.86138)'::geometry], 'car', ARRAY['mode_type=shortest']::text[]);
ERROR: Routing is not allowed ERROR: Routing permission denied
SELECT cdb_route_with_waypoints(Array['POINT(-87.81406 41.89308)'::geometry,'POINT(-87.80406 41.87308)'::geometry,'POINT(-87.79209 41.86138)'::geometry], 'car', ARRAY[]::text[], 'miles'); SELECT cdb_route_with_waypoints(Array['POINT(-87.81406 41.89308)'::geometry,'POINT(-87.80406 41.87308)'::geometry,'POINT(-87.79209 41.86138)'::geometry], 'car', ARRAY[]::text[], 'miles');
ERROR: Routing is not allowed ERROR: Routing permission denied
-- Grant routing permissions -- Grant routing permissions
SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing"]}'); SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing"]}');
cdb_conf_setconf cdb_conf_setconf

View File

@ -30,27 +30,27 @@ ERROR: permission denied for function _cdb_route_point_to_point
-- -- it is public, it shall work -- -- it is public, it shall work
-- No permissions granted -- No permissions granted
SELECT cdb_geocode_admin0_polygon('Spain'); SELECT cdb_geocode_admin0_polygon('Spain');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_admin1_polygon('California'); SELECT cdb_geocode_admin1_polygon('California');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_admin1_polygon('California', 'United States'); SELECT cdb_geocode_admin1_polygon('California', 'United States');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_namedplace_point('Elx'); SELECT cdb_geocode_namedplace_point('Elx');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_namedplace_point('Elx', 'Valencia'); SELECT cdb_geocode_namedplace_point('Elx', 'Valencia');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_namedplace_point('Elx', 'Valencia', 'Spain'); SELECT cdb_geocode_namedplace_point('Elx', 'Valencia', 'Spain');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_postalcode_polygon('03204', 'Spain'); SELECT cdb_geocode_postalcode_polygon('03204', 'Spain');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_postalcode_point('03204', 'Spain'); SELECT cdb_geocode_postalcode_point('03204', 'Spain');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_ipaddress_point('8.8.8.8'); SELECT cdb_geocode_ipaddress_point('8.8.8.8');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_street_point('one street, 1'); SELECT cdb_geocode_street_point('one street, 1');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_route_point_to_point('POINT(-87.81406 41.89308)'::geometry,'POINT(-87.79209 41.86138)'::geometry, 'car'); SELECT cdb_route_point_to_point('POINT(-87.81406 41.89308)'::geometry,'POINT(-87.79209 41.86138)'::geometry, 'car');
ERROR: Routing is not allowed ERROR: Routing permission denied
-- Grant other permissions but geocoding and routing -- Grant other permissions but geocoding and routing
SET ROLE postgres; SET ROLE postgres;
SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["isolines"]}'); SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["isolines"]}');
@ -61,27 +61,27 @@ SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["isolines"]}');
SET ROLE test_regular_user; -- Use regular user role SET ROLE test_regular_user; -- Use regular user role
SELECT cdb_geocode_admin0_polygon('Spain'); SELECT cdb_geocode_admin0_polygon('Spain');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_admin1_polygon('California'); SELECT cdb_geocode_admin1_polygon('California');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_admin1_polygon('California', 'United States'); SELECT cdb_geocode_admin1_polygon('California', 'United States');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_namedplace_point('Elx'); SELECT cdb_geocode_namedplace_point('Elx');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_namedplace_point('Elx', 'Valencia'); SELECT cdb_geocode_namedplace_point('Elx', 'Valencia');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_namedplace_point('Elx', 'Valencia', 'Spain'); SELECT cdb_geocode_namedplace_point('Elx', 'Valencia', 'Spain');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_postalcode_polygon('03204', 'Spain'); SELECT cdb_geocode_postalcode_polygon('03204', 'Spain');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_postalcode_point('03204', 'Spain'); SELECT cdb_geocode_postalcode_point('03204', 'Spain');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_ipaddress_point('8.8.8.8'); SELECT cdb_geocode_ipaddress_point('8.8.8.8');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_geocode_street_point('one street, 1'); SELECT cdb_geocode_street_point('one street, 1');
ERROR: Geocoding is not allowed ERROR: Geocoding permission denied
SELECT cdb_route_point_to_point('POINT(-87.81406 41.89308)'::geometry,'POINT(-87.79209 41.86138)'::geometry, 'car'); SELECT cdb_route_point_to_point('POINT(-87.81406 41.89308)'::geometry,'POINT(-87.79209 41.86138)'::geometry, 'car');
ERROR: Routing is not allowed ERROR: Routing permission denied
-- Grant geocoding permissions -- Grant geocoding permissions
SET ROLE postgres; SET ROLE postgres;
SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["geocoding", "routing"]}'); SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["geocoding", "routing"]}');