dataservices-api/client/test/expected/999_permissions_test.out

179 lines
8.4 KiB
Plaintext
Raw Normal View History

\set VERBOSITY terse
2016-02-24 23:58:14 +08:00
-- Use regular user role
SET ROLE test_regular_user;
-- Add to the search path the schema
SET search_path TO public,cartodb,cdb_dataservices_client;
2018-09-06 22:40:05 +08:00
-- Check the regular user has no permissions on private functions
2018-09-10 18:54:37 +08:00
SELECT _cdb_geocode_admin0_polygon('evil_user', 'evil_orgname', 'Hell');
2018-09-06 22:40:05 +08:00
ERROR: permission denied for function _cdb_geocode_admin0_polygon
2018-09-10 18:54:37 +08:00
SELECT _cdb_geocode_admin1_polygon('evil_user', 'evil_orgname', 'Hell');
2018-09-06 22:40:05 +08:00
ERROR: permission denied for function _cdb_geocode_admin1_polygon
2018-09-10 18:54:37 +08:00
SELECT _cdb_geocode_admin1_polygon('evil_user', 'evil_orgname', 'Sheol', 'Hell');
2018-09-06 22:40:05 +08:00
ERROR: permission denied for function _cdb_geocode_admin1_polygon
2018-09-10 18:54:37 +08:00
SELECT _cdb_geocode_namedplace_point('evil_user', 'evil_orgname', 'Sheol');
2018-09-06 22:40:05 +08:00
ERROR: permission denied for function _cdb_geocode_namedplace_point
2018-09-10 18:54:37 +08:00
SELECT _cdb_geocode_namedplace_point('evil_user', 'evil_orgname', 'Sheol', 'Hell');
2018-09-06 22:40:05 +08:00
ERROR: permission denied for function _cdb_geocode_namedplace_point
2018-09-10 18:54:37 +08:00
SELECT _cdb_geocode_namedplace_point('evil_user', 'evil_orgname', 'Sheol', 'Hell', 'Ugly world');
2018-09-06 22:40:05 +08:00
ERROR: permission denied for function _cdb_geocode_namedplace_point
2018-09-10 18:54:37 +08:00
SELECT _cdb_geocode_postalcode_polygon('evil_user', 'evil_orgname', '66666', 'Hell');
2018-09-06 22:40:05 +08:00
ERROR: permission denied for function _cdb_geocode_postalcode_polygon
2018-09-10 18:54:37 +08:00
SELECT _cdb_geocode_postalcode_point('evil_user', 'evil_orgname', '66666', 'Hell');
2018-09-06 22:40:05 +08:00
ERROR: permission denied for function _cdb_geocode_postalcode_point
2018-09-10 18:54:37 +08:00
SELECT _cdb_geocode_ipaddress_point('evil_user', 'evil_orgname', '8.8.8.8');
2018-09-06 22:40:05 +08:00
ERROR: permission denied for function _cdb_geocode_ipaddress_point
2018-09-10 18:54:37 +08:00
SELECT _cdb_geocode_street_point('evil_user', 'evil_orgname', 'one street, 1');
2018-09-06 22:40:05 +08:00
ERROR: permission denied for function _cdb_geocode_street_point
2018-09-10 18:54:37 +08:00
SELECT _cdb_route_point_to_point('evil_user', 'evil_orgname', 'POINT(-87.81406 41.89308)'::geometry,'POINT(-87.79209 41.86138)'::geometry, 'car');
2018-09-06 22:40:05 +08:00
ERROR: permission denied for function _cdb_route_point_to_point
-- -- Exercise the public function
-- -- it is public, it shall work
-- No permissions granted
2016-02-24 23:58:14 +08:00
SELECT cdb_geocode_admin0_polygon('Spain');
2018-09-10 22:45:31 +08:00
ERROR: Geocoding permission denied
2018-09-06 22:40:05 +08:00
SELECT cdb_geocode_admin1_polygon('California');
2018-09-10 22:45:31 +08:00
ERROR: Geocoding permission denied
2018-09-06 22:40:05 +08:00
SELECT cdb_geocode_admin1_polygon('California', 'United States');
2018-09-10 22:45:31 +08:00
ERROR: Geocoding permission denied
2018-09-06 22:40:05 +08:00
SELECT cdb_geocode_namedplace_point('Elx');
2018-09-10 22:45:31 +08:00
ERROR: Geocoding permission denied
2018-09-06 22:40:05 +08:00
SELECT cdb_geocode_namedplace_point('Elx', 'Valencia');
2018-09-10 22:45:31 +08:00
ERROR: Geocoding permission denied
2018-09-06 22:40:05 +08:00
SELECT cdb_geocode_namedplace_point('Elx', 'Valencia', 'Spain');
2018-09-10 22:45:31 +08:00
ERROR: Geocoding permission denied
2018-09-06 22:40:05 +08:00
SELECT cdb_geocode_postalcode_polygon('03204', 'Spain');
2018-09-10 22:45:31 +08:00
ERROR: Geocoding permission denied
2018-09-06 22:40:05 +08:00
SELECT cdb_geocode_postalcode_point('03204', 'Spain');
2018-09-10 22:45:31 +08:00
ERROR: Geocoding permission denied
2018-09-06 22:40:05 +08:00
SELECT cdb_geocode_ipaddress_point('8.8.8.8');
2018-09-10 22:45:31 +08:00
ERROR: Geocoding permission denied
2018-09-06 22:40:05 +08:00
SELECT cdb_geocode_street_point('one street, 1');
2018-09-10 22:45:31 +08:00
ERROR: Geocoding permission denied
2018-09-06 22:40:05 +08:00
SELECT cdb_route_point_to_point('POINT(-87.81406 41.89308)'::geometry,'POINT(-87.79209 41.86138)'::geometry, 'car');
2018-09-10 22:45:31 +08:00
ERROR: Routing permission denied
2018-09-06 22:40:05 +08:00
-- Grant other permissions but geocoding and routing
SET ROLE postgres;
2018-09-10 19:40:15 +08:00
SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["isolines"]}');
2018-09-06 22:40:05 +08:00
cdb_conf_setconf
------------------
(1 row)
SET ROLE test_regular_user; -- Use regular user role
SELECT cdb_geocode_admin0_polygon('Spain');
2018-09-10 22:45:31 +08:00
ERROR: Geocoding permission denied
2018-09-06 22:40:05 +08:00
SELECT cdb_geocode_admin1_polygon('California');
2018-09-10 22:45:31 +08:00
ERROR: Geocoding permission denied
2018-09-06 22:40:05 +08:00
SELECT cdb_geocode_admin1_polygon('California', 'United States');
2018-09-10 22:45:31 +08:00
ERROR: Geocoding permission denied
2018-09-06 22:40:05 +08:00
SELECT cdb_geocode_namedplace_point('Elx');
2018-09-10 22:45:31 +08:00
ERROR: Geocoding permission denied
2018-09-06 22:40:05 +08:00
SELECT cdb_geocode_namedplace_point('Elx', 'Valencia');
2018-09-10 22:45:31 +08:00
ERROR: Geocoding permission denied
2018-09-06 22:40:05 +08:00
SELECT cdb_geocode_namedplace_point('Elx', 'Valencia', 'Spain');
2018-09-10 22:45:31 +08:00
ERROR: Geocoding permission denied
2018-09-06 22:40:05 +08:00
SELECT cdb_geocode_postalcode_polygon('03204', 'Spain');
2018-09-10 22:45:31 +08:00
ERROR: Geocoding permission denied
2018-09-06 22:40:05 +08:00
SELECT cdb_geocode_postalcode_point('03204', 'Spain');
2018-09-10 22:45:31 +08:00
ERROR: Geocoding permission denied
2018-09-06 22:40:05 +08:00
SELECT cdb_geocode_ipaddress_point('8.8.8.8');
2018-09-10 22:45:31 +08:00
ERROR: Geocoding permission denied
2018-09-06 22:40:05 +08:00
SELECT cdb_geocode_street_point('one street, 1');
2018-09-10 22:45:31 +08:00
ERROR: Geocoding permission denied
2018-09-06 22:40:05 +08:00
SELECT cdb_route_point_to_point('POINT(-87.81406 41.89308)'::geometry,'POINT(-87.79209 41.86138)'::geometry, 'car');
2018-09-10 22:45:31 +08:00
ERROR: Routing permission denied
2018-09-06 22:40:05 +08:00
-- Grant geocoding permissions
SET ROLE postgres;
2018-09-10 19:40:15 +08:00
SELECT CDB_Conf_SetConf('api_keys_postgres', '{"permissions": ["geocoding", "routing"]}');
2018-09-06 22:40:05 +08:00
cdb_conf_setconf
------------------
(1 row)
SET ROLE test_regular_user; -- Use regular user role
SELECT cdb_geocode_admin0_polygon('Spain');
2018-09-10 19:40:15 +08:00
NOTICE: cdb_dataservices_client._cdb_geocode_admin0_polygon(3): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_admin0_polygon invoked with params (test_user, <NULL>, Spain)
2016-02-24 23:58:14 +08:00
cdb_geocode_admin0_polygon
----------------------------
(1 row)
SELECT cdb_geocode_admin1_polygon('California');
2018-09-10 19:40:15 +08:00
NOTICE: cdb_dataservices_client._cdb_geocode_admin1_polygon(3): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_admin1_polygon invoked with params (test_user, <NULL>, California)
2016-02-24 23:58:14 +08:00
cdb_geocode_admin1_polygon
----------------------------
(1 row)
SELECT cdb_geocode_admin1_polygon('California', 'United States');
2018-09-10 19:40:15 +08:00
NOTICE: cdb_dataservices_client._cdb_geocode_admin1_polygon(4): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_admin1_polygon invoked with params (test_user, <NULL>, California, United States)
2016-02-24 23:58:14 +08:00
cdb_geocode_admin1_polygon
----------------------------
(1 row)
SELECT cdb_geocode_namedplace_point('Elx');
2018-09-10 19:40:15 +08:00
NOTICE: cdb_dataservices_client._cdb_geocode_namedplace_point(3): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_namedplace_point invoked with params (test_user, <NULL>, Elx)
2016-02-24 23:58:14 +08:00
cdb_geocode_namedplace_point
------------------------------
(1 row)
SELECT cdb_geocode_namedplace_point('Elx', 'Valencia');
2018-09-10 19:40:15 +08:00
NOTICE: cdb_dataservices_client._cdb_geocode_namedplace_point(4): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_namedplace_point invoked with params (test_user, <NULL>, Elx, Valencia)
2016-02-24 23:58:14 +08:00
cdb_geocode_namedplace_point
------------------------------
(1 row)
SELECT cdb_geocode_namedplace_point('Elx', 'Valencia', 'Spain');
2018-09-10 19:40:15 +08:00
NOTICE: cdb_dataservices_client._cdb_geocode_namedplace_point(5): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_namedplace_point invoked with params (test_user, <NULL>, Elx, Valencia, Spain)
2016-02-24 23:58:14 +08:00
cdb_geocode_namedplace_point
------------------------------
(1 row)
SELECT cdb_geocode_postalcode_polygon('03204', 'Spain');
2018-09-10 19:40:15 +08:00
NOTICE: cdb_dataservices_client._cdb_geocode_postalcode_polygon(4): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_postalcode_polygon invoked with params (test_user, <NULL>, 03204, Spain)
2016-02-24 23:58:14 +08:00
cdb_geocode_postalcode_polygon
--------------------------------
(1 row)
SELECT cdb_geocode_postalcode_point('03204', 'Spain');
2018-09-10 19:40:15 +08:00
NOTICE: cdb_dataservices_client._cdb_geocode_postalcode_point(4): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_postalcode_point invoked with params (test_user, <NULL>, 03204, Spain)
2016-02-24 23:58:14 +08:00
cdb_geocode_postalcode_point
------------------------------
(1 row)
SELECT cdb_geocode_ipaddress_point('8.8.8.8');
2018-09-10 19:40:15 +08:00
NOTICE: cdb_dataservices_client._cdb_geocode_ipaddress_point(3): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_ipaddress_point invoked with params (test_user, <NULL>, 8.8.8.8)
2016-02-24 23:58:14 +08:00
cdb_geocode_ipaddress_point
-----------------------------
(1 row)
SELECT cdb_geocode_street_point('one street, 1');
2018-09-10 19:40:15 +08:00
NOTICE: cdb_dataservices_client._cdb_geocode_street_point(6): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_geocode_geocoder_street_point invoked with params (test_user, <NULL>, one street, 1, <NULL>, <NULL>, <NULL>)
2016-02-24 23:58:14 +08:00
cdb_geocode_street_point
--------------------------
(1 row)
SELECT cdb_route_point_to_point('POINT(-87.81406 41.89308)'::geometry,'POINT(-87.79209 41.86138)'::geometry, 'car');
2018-09-10 19:40:15 +08:00
NOTICE: cdb_dataservices_client._cdb_route_point_to_point(7): [contrib_regression] REMOTE NOTICE: cdb_dataservices_server.cdb_route_point_to_point invoked with params (test_user, <NULL>, 0101000000D53E1D8F19F455C0185B087250F24440, 0101000000465F419AB1F255C0D8B628B341EE4440, car, {}, kilometers)
2016-02-24 23:58:14 +08:00
cdb_route_point_to_point
--------------------------
(,5.33,100)
(1 row)
2018-09-06 22:40:05 +08:00
-- Remove permissions
SET ROLE postgres;
SELECT CDB_Conf_RemoveConf('api_keys_postgres');
cdb_conf_removeconf
---------------------
(1 row)