Changed error message
This commit is contained in:
parent
f4cb9ba812
commit
08daa6a6a2
@ -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 }
|
||||
|
@ -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';
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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"]}');
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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"]}');
|
||||
|
Loading…
Reference in New Issue
Block a user