From 08daa6a6a2e450191949ab6f234f469b6b9fdd51 Mon Sep 17 00:00:00 2001 From: antoniocarlon Date: Mon, 10 Sep 2018 16:45:31 +0200 Subject: [PATCH] Changed error message --- client/renderer/interface.yaml | 40 ++++++++--------- .../templates/20_public_functions.erb | 6 +-- client/sql/21_bulk_geocoding_functions.sql | 2 +- client/test/expected/10_admin0_test.out | 4 +- client/test/expected/20_admin1_test.out | 8 ++-- .../21_bulk_geocoding_functions_test.out | 8 ++-- ..._exception_safe_private_functions_test.out | 8 ++-- client/test/expected/30_namedplaces_test.out | 12 ++--- client/test/expected/40_postalcodes_test.out | 8 ++-- client/test/expected/50_ipaddresses_test.out | 4 +- client/test/expected/60_street_test.out | 40 ++++++++--------- .../expected/80_route_point_to_point_test.out | 24 +++++----- client/test/expected/999_permissions_test.out | 44 +++++++++---------- 13 files changed, 104 insertions(+), 104 deletions(-) diff --git a/client/renderer/interface.yaml b/client/renderer/interface.yaml index 97ad5cc..95d7e88 100644 --- a/client/renderer/interface.yaml +++ b/client/renderer/interface.yaml @@ -3,7 +3,7 @@ return_type: Geometry requires_permission: true permission_name: geocoding - permission_error: Geocoding is not allowed + permission_error: Geocoding permission denied params: - { name: country_name, type: text } @@ -11,7 +11,7 @@ return_type: Geometry requires_permission: true permission_name: geocoding - permission_error: Geocoding is not allowed + permission_error: Geocoding permission denied params: - { name: admin1_name, type: text } @@ -19,7 +19,7 @@ return_type: Geometry requires_permission: true permission_name: geocoding - permission_error: Geocoding is not allowed + permission_error: Geocoding permission denied params: - { name: admin1_name, type: text } - { name: country_name, type: text } @@ -28,7 +28,7 @@ return_type: Geometry requires_permission: true permission_name: geocoding - permission_error: Geocoding is not allowed + permission_error: Geocoding permission denied params: - { name: city_name, type: text} @@ -36,7 +36,7 @@ return_type: Geometry requires_permission: true permission_name: geocoding - permission_error: Geocoding is not allowed + permission_error: Geocoding permission denied params: - { name: city_name, type: text} - { name: country_name, type: text} @@ -45,7 +45,7 @@ return_type: Geometry requires_permission: true permission_name: geocoding - permission_error: Geocoding is not allowed + permission_error: Geocoding permission denied params: - { name: city_name, type: text} - { name: admin1_name, type: text} @@ -55,7 +55,7 @@ return_type: Geometry requires_permission: true permission_name: geocoding - permission_error: Geocoding is not allowed + permission_error: Geocoding permission denied params: - { name: postal_code, type: text} - { name: country_name, type: text} @@ -64,7 +64,7 @@ return_type: Geometry requires_permission: true permission_name: geocoding - permission_error: Geocoding is not allowed + permission_error: Geocoding permission denied params: - { name: postal_code, type: double precision} - { name: country_name, type: text} @@ -73,7 +73,7 @@ return_type: Geometry requires_permission: true permission_name: geocoding - permission_error: Geocoding is not allowed + permission_error: Geocoding permission denied params: - { name: postal_code, type: text} - { name: country_name, type: text} @@ -82,7 +82,7 @@ return_type: Geometry requires_permission: true permission_name: geocoding - permission_error: Geocoding is not allowed + permission_error: Geocoding permission denied params: - { name: postal_code, type: double precision} - { name: country_name, type: text} @@ -91,7 +91,7 @@ return_type: Geometry requires_permission: true permission_name: geocoding - permission_error: Geocoding is not allowed + permission_error: Geocoding permission denied params: - { name: ip_address, type: text} @@ -99,7 +99,7 @@ return_type: Geometry requires_permission: true permission_name: geocoding - permission_error: Geocoding is not allowed + permission_error: Geocoding permission denied params: - { name: searchtext, type: text} - { name: city, type: text, default: 'NULL'} @@ -112,7 +112,7 @@ multi_field: true requires_permission: true permission_name: geocoding - permission_error: Geocoding is not allowed + permission_error: Geocoding permission denied params: - { name: searches, type: jsonb } # Array of JSON objects with id, address, city, state and country fields @@ -120,7 +120,7 @@ return_type: Geometry requires_permission: true permission_name: geocoding - permission_error: Geocoding is not allowed + permission_error: Geocoding permission denied params: - { name: searchtext, type: text} - { name: city, type: text, default: 'NULL'} @@ -131,7 +131,7 @@ return_type: Geometry requires_permission: true permission_name: geocoding - permission_error: Geocoding is not allowed + permission_error: Geocoding permission denied params: - { name: searchtext, type: text} - { name: city, type: text, default: 'NULL'} @@ -142,7 +142,7 @@ return_type: Geometry requires_permission: true permission_name: geocoding - permission_error: Geocoding is not allowed + permission_error: Geocoding permission denied params: - { name: searchtext, type: text} - { name: city, type: text, default: 'NULL'} @@ -153,7 +153,7 @@ return_type: Geometry requires_permission: true permission_name: geocoding - permission_error: Geocoding is not allowed + permission_error: Geocoding permission denied params: - { name: searchtext, type: text} - { name: city, type: text, default: 'NULL'} @@ -164,7 +164,7 @@ return_type: Geometry requires_permission: true permission_name: geocoding - permission_error: Geocoding is not allowed + permission_error: Geocoding permission denied params: - { name: searchtext, type: text} - { name: city, type: text, default: 'NULL'} @@ -280,7 +280,7 @@ multi_field: true requires_permission: true permission_name: routing - permission_error: Routing is not allowed + permission_error: Routing permission denied params: - { name: origin, type: "geometry(Point, 4326)" } - { name: destination, type: "geometry(Point, 4326)" } @@ -293,7 +293,7 @@ multi_field: true requires_permission: true permission_name: routing - permission_error: Routing is not allowed + permission_error: Routing permission denied params: - { name: waypoints, type: "geometry(Point, 4326)[]" } - { name: mode, type: text } diff --git a/client/renderer/templates/20_public_functions.erb b/client/renderer/templates/20_public_functions.erb index 3950037..07953aa 100644 --- a/client/renderer/templates/20_public_functions.erb +++ b/client/renderer/templates/20_public_functions.erb @@ -16,9 +16,9 @@ BEGIN 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); <% if requires_permission %>IF apikey_permissions IS NULL OR NOT apikey_permissions::jsonb ? '<%= permission_name %>' THEN - RAISE EXCEPTION '<%= permission_error %>'; - END IF; - <% else %>SELECT u, o INTO username, orgname FROM <%= DATASERVICES_CLIENT_SCHEMA %>._cdb_entity_config() AS (u text, o text, p json);<% end %><% end %> + RAISE EXCEPTION '<%= permission_error %>' USING ERRCODE = 'CDB403'; + 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 %> -- JSON value stored "" is taken as literal IF username IS NULL OR username = '' OR username = '""' THEN RAISE EXCEPTION 'Username is a mandatory argument, check it out'; diff --git a/client/sql/21_bulk_geocoding_functions.sql b/client/sql/21_bulk_geocoding_functions.sql index 5fd9284..0276836 100644 --- a/client/sql/21_bulk_geocoding_functions.sql +++ b/client/sql/21_bulk_geocoding_functions.sql @@ -22,7 +22,7 @@ BEGIN 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); 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; -- JSON value stored "" is taken as literal diff --git a/client/test/expected/10_admin0_test.out b/client/test/expected/10_admin0_test.out index 3df63e9..9046dce 100644 --- a/client/test/expected/10_admin0_test.out +++ b/client/test/expected/10_admin0_test.out @@ -12,7 +12,7 @@ $$ LANGUAGE 'plpgsql'; -- -- Exercise the public and the proxied function -- No permissions granted SELECT cdb_geocode_admin0_polygon('Spain'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied -- Grant other permissions but geocoding SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing", "isolines"]}'); cdb_conf_setconf @@ -21,7 +21,7 @@ SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing", "isoli (1 row) SELECT cdb_geocode_admin0_polygon('Spain'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied -- Grant geocoding permissions SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["geocoding"]}'); cdb_conf_setconf diff --git a/client/test/expected/20_admin1_test.out b/client/test/expected/20_admin1_test.out index 62ee741..4c1839e 100644 --- a/client/test/expected/20_admin1_test.out +++ b/client/test/expected/20_admin1_test.out @@ -19,9 +19,9 @@ $$ LANGUAGE 'plpgsql'; -- -- Exercise the public and the proxied function -- No permissions granted SELECT cdb_geocode_admin1_polygon('California'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied SELECT cdb_geocode_admin1_polygon('California', 'United States'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied -- Grant other permissions but geocoding SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing", "isolines"]}'); cdb_conf_setconf @@ -30,9 +30,9 @@ SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing", "isoli (1 row) SELECT cdb_geocode_admin1_polygon('California'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied SELECT cdb_geocode_admin1_polygon('California', 'United States'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied -- Grant geocoding permissions SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["geocoding"]}'); cdb_conf_setconf diff --git a/client/test/expected/21_bulk_geocoding_functions_test.out b/client/test/expected/21_bulk_geocoding_functions_test.out index da5d74a..16c370d 100644 --- a/client/test/expected/21_bulk_geocoding_functions_test.out +++ b/client/test/expected/21_bulk_geocoding_functions_test.out @@ -12,10 +12,10 @@ $$ LANGUAGE SQL; -- No permissions granted -- 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); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied -- Test quota check by mocking quota 0 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 SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing", "isolines"]}'); 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) 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 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 SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["geocoding"]}'); cdb_conf_setconf diff --git a/client/test/expected/25_exception_safe_private_functions_test.out b/client/test/expected/25_exception_safe_private_functions_test.out index da25c75..444c35f 100644 --- a/client/test/expected/25_exception_safe_private_functions_test.out +++ b/client/test/expected/25_exception_safe_private_functions_test.out @@ -31,11 +31,11 @@ $$ LANGUAGE 'plpgsql'; -- No permissions granted SET ROLE test_regular_user; -- Use regular user role 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[]); 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[]); -ERROR: Routing is not allowed +ERROR: Routing permission denied -- No permissions granted but conf created SET ROLE postgres; 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 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[]); 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[]); -ERROR: Routing is not allowed +ERROR: Routing permission denied -- Grant geocoding permissions SET ROLE postgres; SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["geocoding", "routing", "isolines"]}'); diff --git a/client/test/expected/30_namedplaces_test.out b/client/test/expected/30_namedplaces_test.out index acbb6b7..095d4b3 100644 --- a/client/test/expected/30_namedplaces_test.out +++ b/client/test/expected/30_namedplaces_test.out @@ -26,11 +26,11 @@ $$ LANGUAGE 'plpgsql'; -- -- Exercise the public and the proxied function -- No permissions granted SELECT cdb_geocode_namedplace_point('Elx'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied SELECT cdb_geocode_namedplace_point('Elx', 'Spain'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied SELECT cdb_geocode_namedplace_point('Elx', 'Valencia', 'Spain'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied -- Grant other permissions but geocoding SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing", "isolines"]}'); cdb_conf_setconf @@ -39,11 +39,11 @@ SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing", "isoli (1 row) SELECT cdb_geocode_namedplace_point('Elx'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied SELECT cdb_geocode_namedplace_point('Elx', 'Spain'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied SELECT cdb_geocode_namedplace_point('Elx', 'Valencia', 'Spain'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied -- Grant geocoding permissions SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["geocoding"]}'); cdb_conf_setconf diff --git a/client/test/expected/40_postalcodes_test.out b/client/test/expected/40_postalcodes_test.out index b3a41e7..e66f912 100644 --- a/client/test/expected/40_postalcodes_test.out +++ b/client/test/expected/40_postalcodes_test.out @@ -19,9 +19,9 @@ $$ LANGUAGE 'plpgsql'; -- -- Exercise the public and the proxied function -- No permissions granted SELECT cdb_geocode_postalcode_polygon('03204', 'Spain'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied SELECT cdb_geocode_postalcode_point('03204', 'Spain'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied -- Grant other permissions but geocoding SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing", "isolines"]}'); cdb_conf_setconf @@ -30,9 +30,9 @@ SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing", "isoli (1 row) SELECT cdb_geocode_postalcode_polygon('03204', 'Spain'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied SELECT cdb_geocode_postalcode_point('03204', 'Spain'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied -- Grant geocoding permissions SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["geocoding"]}'); cdb_conf_setconf diff --git a/client/test/expected/50_ipaddresses_test.out b/client/test/expected/50_ipaddresses_test.out index 72e1bf2..36acf41 100644 --- a/client/test/expected/50_ipaddresses_test.out +++ b/client/test/expected/50_ipaddresses_test.out @@ -12,7 +12,7 @@ $$ LANGUAGE 'plpgsql'; -- -- Exercise the public and the proxied function -- No permissions granted SELECT cdb_geocode_ipaddress_point('8.8.8.8'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied -- Grant other permissions but geocoding SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing", "isolines"]}'); cdb_conf_setconf @@ -21,7 +21,7 @@ SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing", "isoli (1 row) SELECT cdb_geocode_ipaddress_point('8.8.8.8'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied -- Grant geocoding permissions SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["geocoding"]}'); cdb_conf_setconf diff --git a/client/test/expected/60_street_test.out b/client/test/expected/60_street_test.out index c64d4f6..ce4df0b 100644 --- a/client/test/expected/60_street_test.out +++ b/client/test/expected/60_street_test.out @@ -12,25 +12,25 @@ $$ LANGUAGE 'plpgsql'; -- -- Exercise the public and the proxied function -- No permissions granted 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'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied 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'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied 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'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied 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'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied 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'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied -- Grant other permissions but geocoding SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing", "isolines"]}'); cdb_conf_setconf @@ -39,25 +39,25 @@ SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing", "isoli (1 row) 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'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied 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'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied 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'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied 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'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied 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'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied -- Grant geocoding permissions SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["geocoding"]}'); cdb_conf_setconf diff --git a/client/test/expected/80_route_point_to_point_test.out b/client/test/expected/80_route_point_to_point_test.out index 9fea2a6..762de95 100644 --- a/client/test/expected/80_route_point_to_point_test.out +++ b/client/test/expected/80_route_point_to_point_test.out @@ -25,17 +25,17 @@ $$ LANGUAGE 'plpgsql'; -- -- Exercise the public and the proxied function -- No permissions granted 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[]); -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'); -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'); -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[]); -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'); -ERROR: Routing is not allowed +ERROR: Routing permission denied -- Grant other permissions but routing SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["geocoding", "isolines"]}'); cdb_conf_setconf @@ -44,17 +44,17 @@ SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["geocoding", "iso (1 row) 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[]); -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'); -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'); -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[]); -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'); -ERROR: Routing is not allowed +ERROR: Routing permission denied -- Grant routing permissions SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["routing"]}'); cdb_conf_setconf diff --git a/client/test/expected/999_permissions_test.out b/client/test/expected/999_permissions_test.out index 21642ab..945f1dc 100644 --- a/client/test/expected/999_permissions_test.out +++ b/client/test/expected/999_permissions_test.out @@ -30,27 +30,27 @@ ERROR: permission denied for function _cdb_route_point_to_point -- -- it is public, it shall work -- No permissions granted SELECT cdb_geocode_admin0_polygon('Spain'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied SELECT cdb_geocode_admin1_polygon('California'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied SELECT cdb_geocode_admin1_polygon('California', 'United States'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied SELECT cdb_geocode_namedplace_point('Elx'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied SELECT cdb_geocode_namedplace_point('Elx', 'Valencia'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied SELECT cdb_geocode_namedplace_point('Elx', 'Valencia', 'Spain'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied SELECT cdb_geocode_postalcode_polygon('03204', 'Spain'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied 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'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied 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'); -ERROR: Routing is not allowed +ERROR: Routing permission denied -- Grant other permissions but geocoding and routing SET ROLE postgres; 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 SELECT cdb_geocode_admin0_polygon('Spain'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied SELECT cdb_geocode_admin1_polygon('California'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied SELECT cdb_geocode_admin1_polygon('California', 'United States'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied SELECT cdb_geocode_namedplace_point('Elx'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied SELECT cdb_geocode_namedplace_point('Elx', 'Valencia'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied SELECT cdb_geocode_namedplace_point('Elx', 'Valencia', 'Spain'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied SELECT cdb_geocode_postalcode_polygon('03204', 'Spain'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied 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'); -ERROR: Geocoding is not allowed +ERROR: Geocoding permission denied 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'); -ERROR: Routing is not allowed +ERROR: Routing permission denied -- Grant geocoding permissions SET ROLE postgres; SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["geocoding", "routing"]}');