From 0611e95ea1211778f1cfb97cac62bb4c9f71efc4 Mon Sep 17 00:00:00 2001 From: jordi fita mas Date: Fri, 6 Oct 2023 13:23:20 +0200 Subject: [PATCH] Grant execute to guest for function to_price It is required when showing the prices of campsite types on the public section of the web. --- deploy/to_price.sql | 1 + test/to_price.sql | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/deploy/to_price.sql b/deploy/to_price.sql index 6ccde34..6bc6b0f 100644 --- a/deploy/to_price.sql +++ b/deploy/to_price.sql @@ -28,6 +28,7 @@ comment on function to_price(integer, integer) is 'Converts the cents to a price representation, without currency and any other separater than decimal.'; revoke execute on function to_price(integer, integer) from public; +grant execute on function to_price(integer, integer) to guest; grant execute on function to_price(integer, integer) to employee; grant execute on function to_price(integer, integer) to admin; diff --git a/test/to_price.sql b/test/to_price.sql index 1d1d701..3374a63 100644 --- a/test/to_price.sql +++ b/test/to_price.sql @@ -14,7 +14,7 @@ select function_lang_is('camper', 'to_price', array ['integer', 'integer'], 'plp select function_returns('camper', 'to_price', array ['integer', 'integer'], 'text'); select isnt_definer('camper', 'to_price', array ['integer', 'integer']); select volatility_is('camper', 'to_price', array ['integer', 'integer'], 'immutable'); -select function_privs_are('camper', 'to_price', array ['integer', 'integer'], 'guest', array []::text[]); +select function_privs_are('camper', 'to_price', array ['integer', 'integer'], 'guest', array ['EXECUTE']); select function_privs_are('camper', 'to_price', array ['integer', 'integer'], 'employee', array ['EXECUTE']); select function_privs_are('camper', 'to_price', array ['integer', 'integer'], 'admin', array ['EXECUTE']); select function_privs_are('camper', 'to_price', array ['integer', 'integer'], 'authenticator', array []::text[]);