Managing public api key permissions
This commit is contained in:
parent
e82fb49028
commit
b6d37c6773
@ -11,9 +11,9 @@ DECLARE
|
|||||||
<%= user_org_declaration %>
|
<%= user_org_declaration %>
|
||||||
<% unless superuser_function? -%>apikey_permissions json;<% end %>
|
<% unless superuser_function? -%>apikey_permissions json;<% end %>
|
||||||
BEGIN
|
BEGIN
|
||||||
IF session_user = 'publicuser' OR session_user ~ 'cartodb_publicuser_*' THEN
|
<% unless requires_permission %>IF session_user = 'publicuser' OR session_user ~ 'cartodb_publicuser_*' THEN
|
||||||
RAISE EXCEPTION 'The api_key must be provided';
|
RAISE EXCEPTION 'The api_key must be provided';
|
||||||
END IF;
|
END IF;<% end %>
|
||||||
<% 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);
|
<% 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
|
<% if requires_permission %>IF apikey_permissions IS NULL OR NOT apikey_permissions::jsonb ? '<%= permission_name %>' THEN
|
||||||
RAISE EXCEPTION '<%= permission_error %>' USING ERRCODE = '01007';
|
RAISE EXCEPTION '<%= permission_error %>' USING ERRCODE = '01007';
|
||||||
|
Loading…
Reference in New Issue
Block a user