Dont use the defaults in the grant script
This commit is contained in:
parent
49941a78f3
commit
7cce491a13
@ -7,4 +7,4 @@ GRANT EXECUTE ON FUNCTION cdb_geocoder_client.cdb_geocode_namedplace_point(city_
|
|||||||
GRANT EXECUTE ON FUNCTION cdb_geocoder_client.cdb_geocode_postalcode_polygon(postal_code text, country_name text) TO publicuser;
|
GRANT EXECUTE ON FUNCTION cdb_geocoder_client.cdb_geocode_postalcode_polygon(postal_code text, country_name text) TO publicuser;
|
||||||
GRANT EXECUTE ON FUNCTION cdb_geocoder_client.cdb_geocode_postalcode_point(postal_code text, country_name text) TO publicuser;
|
GRANT EXECUTE ON FUNCTION cdb_geocoder_client.cdb_geocode_postalcode_point(postal_code text, country_name text) TO publicuser;
|
||||||
GRANT EXECUTE ON FUNCTION cdb_geocoder_client.cdb_geocode_ipaddress_point(ip_address text) TO publicuser;
|
GRANT EXECUTE ON FUNCTION cdb_geocoder_client.cdb_geocode_ipaddress_point(ip_address text) TO publicuser;
|
||||||
GRANT EXECUTE ON FUNCTION cdb_geocoder_client.cdb_geocode_street_point(searchtext text, city text DEFAULT NULL, state_province text DEFAULT NULL, country text DEFAULT NULL) TO publicuser;
|
GRANT EXECUTE ON FUNCTION cdb_geocoder_client.cdb_geocode_street_point(searchtext text, city text, state_province text, country text) TO publicuser;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
-- These are the only ones with permissions to publicuser role
|
-- These are the only ones with permissions to publicuser role
|
||||||
-- and should also be the only ones with SECURITY DEFINER
|
-- and should also be the only ones with SECURITY DEFINER
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>.<%= name %> (<%= params_with_type %>)
|
CREATE OR REPLACE FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>.<%= name %> (<%= params_with_type_and_default %>)
|
||||||
RETURNS <%= return_type %> AS $$
|
RETURNS <%= return_type %> AS $$
|
||||||
DECLARE
|
DECLARE
|
||||||
ret <%= return_type %>;
|
ret <%= return_type %>;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
CREATE OR REPLACE FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>._<%= name %> (username text, organization_name text, <%= params_with_type %>)
|
CREATE OR REPLACE FUNCTION <%= GEOCODER_CLIENT_SCHEMA %>._<%= name %> (username text, organization_name text, <%= params_with_type_and_default %>)
|
||||||
RETURNS <%= return_type %> AS $$
|
RETURNS <%= return_type %> AS $$
|
||||||
CONNECT <%= GEOCODER_CLIENT_SCHEMA %>._server_conn_str();
|
CONNECT <%= GEOCODER_CLIENT_SCHEMA %>._server_conn_str();
|
||||||
SELECT cdb_geocoder_server.<%= name %> (username, organization_name, <%= params %>);
|
SELECT cdb_geocoder_server.<%= name %> (username, organization_name, <%= params %>);
|
||||||
|
@ -40,6 +40,10 @@ class SqlTemplateRenderer
|
|||||||
end
|
end
|
||||||
|
|
||||||
def params_with_type
|
def params_with_type
|
||||||
|
@function_signature['params'].map { |p| "#{p['name']} #{p['type']}" }.join(', ')
|
||||||
|
end
|
||||||
|
|
||||||
|
def params_with_type_and_default
|
||||||
parameters = @function_signature['params'].map do |p|
|
parameters = @function_signature['params'].map do |p|
|
||||||
if not p['default'].nil?
|
if not p['default'].nil?
|
||||||
"#{p['name']} #{p['type']} DEFAULT #{p['default']}"
|
"#{p['name']} #{p['type']} DEFAULT #{p['default']}"
|
||||||
@ -49,7 +53,6 @@ class SqlTemplateRenderer
|
|||||||
end
|
end
|
||||||
return parameters.join(', ')
|
return parameters.join(', ')
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user