Getting the username from cdb_conf

This commit is contained in:
antoniocarlon 2018-09-11 10:14:52 +02:00
parent d5864ccada
commit 4d3e9f2b32

View File

@ -25,16 +25,11 @@ BEGIN
IF is_organization IS NULL THEN
RAISE EXCEPTION 'User must have user configuration in the config table';
ELSIF is_organization = TRUE THEN
SELECT nspname
FROM pg_namespace s
LEFT JOIN pg_roles r ON s.nspowner = r.oid
WHERE r.rolname = session_user INTO username;
SELECT cartodb.cdb_conf_getconf('user_config')->>'entity_name' INTO organization_name;
ELSE
SELECT cartodb.cdb_conf_getconf('user_config')->>'entity_name' INTO username;
organization_name = NULL;
END IF;
result.username = username;
result.username = apikey_config->'username';
result.organization_name = organization_name;
result.apikey_permissions = apikey_config->'permissions';
RETURN result;