Non-public API method naming
This commit is contained in:
parent
e04f0caa6c
commit
b633466724
@ -5,7 +5,7 @@ DECLARE
|
|||||||
cdb_group_role TEXT;
|
cdb_group_role TEXT;
|
||||||
BEGIN
|
BEGIN
|
||||||
-- TODO: escape group_name
|
-- TODO: escape group_name
|
||||||
cdb_group_role := cartodb.CDB_Group_GroupRole(group_name);
|
cdb_group_role := cartodb._CDB_Group_GroupRole(group_name);
|
||||||
IF NOT EXISTS ( SELECT 1 FROM pg_roles WHERE rolname = cdb_group_role )
|
IF NOT EXISTS ( SELECT 1 FROM pg_roles WHERE rolname = cdb_group_role )
|
||||||
THEN
|
THEN
|
||||||
EXECUTE 'CREATE ROLE "' || cdb_group_role || '" NOLOGIN;';
|
EXECUTE 'CREATE ROLE "' || cdb_group_role || '" NOLOGIN;';
|
||||||
@ -19,8 +19,8 @@ CREATE OR REPLACE
|
|||||||
FUNCTION cartodb.CDB_Group_DropGroup(group_name text)
|
FUNCTION cartodb.CDB_Group_DropGroup(group_name text)
|
||||||
RETURNS VOID AS $$
|
RETURNS VOID AS $$
|
||||||
BEGIN
|
BEGIN
|
||||||
EXECUTE 'DROP OWNED BY "' || cartodb.CDB_Group_GroupRole(group_name) || '"';
|
EXECUTE 'DROP OWNED BY "' || cartodb._CDB_Group_GroupRole(group_name) || '"';
|
||||||
EXECUTE 'DROP ROLE IF EXISTS "' || cartodb.CDB_Group_GroupRole(group_name) || '"';
|
EXECUTE 'DROP ROLE IF EXISTS "' || cartodb._CDB_Group_GroupRole(group_name) || '"';
|
||||||
END
|
END
|
||||||
$$ LANGUAGE PLPGSQL;
|
$$ LANGUAGE PLPGSQL;
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ CREATE OR REPLACE
|
|||||||
FUNCTION cartodb.CDB_Group_RenameGroup(old_group_name text, new_group_name text)
|
FUNCTION cartodb.CDB_Group_RenameGroup(old_group_name text, new_group_name text)
|
||||||
RETURNS VOID AS $$
|
RETURNS VOID AS $$
|
||||||
BEGIN
|
BEGIN
|
||||||
EXECUTE 'ALTER ROLE "' || cartodb.CDB_Group_GroupRole(old_group_name) || '" RENAME TO "' || cartodb.CDB_Group_GroupRole(new_group_name) || '"';
|
EXECUTE 'ALTER ROLE "' || cartodb._CDB_Group_GroupRole(old_group_name) || '" RENAME TO "' || cartodb._CDB_Group_GroupRole(new_group_name) || '"';
|
||||||
END
|
END
|
||||||
$$ LANGUAGE PLPGSQL;
|
$$ LANGUAGE PLPGSQL;
|
||||||
|
|
||||||
@ -40,8 +40,8 @@ DECLARE
|
|||||||
cdb_group_role TEXT;
|
cdb_group_role TEXT;
|
||||||
cdb_user_role TEXT;
|
cdb_user_role TEXT;
|
||||||
BEGIN
|
BEGIN
|
||||||
cdb_group_role := cartodb.CDB_Group_GroupRole(group_name);
|
cdb_group_role := cartodb._CDB_Group_GroupRole(group_name);
|
||||||
cdb_user_role := cartodb.CDB_User_RoleFromUsername(username);
|
cdb_user_role := cartodb._CDB_User_RoleFromUsername(username);
|
||||||
EXECUTE 'GRANT "' || cdb_group_role || '" TO "' || cdb_user_role || '"';
|
EXECUTE 'GRANT "' || cdb_group_role || '" TO "' || cdb_user_role || '"';
|
||||||
END
|
END
|
||||||
$$ LANGUAGE PLPGSQL;
|
$$ LANGUAGE PLPGSQL;
|
||||||
@ -53,8 +53,8 @@ DECLARE
|
|||||||
cdb_group_role TEXT;
|
cdb_group_role TEXT;
|
||||||
cdb_user_role TEXT;
|
cdb_user_role TEXT;
|
||||||
BEGIN
|
BEGIN
|
||||||
cdb_group_role := cartodb.CDB_Group_GroupRole(group_name);
|
cdb_group_role := cartodb._CDB_Group_GroupRole(group_name);
|
||||||
cdb_user_role := cartodb.CDB_User_RoleFromUsername(username);
|
cdb_user_role := cartodb._CDB_User_RoleFromUsername(username);
|
||||||
EXECUTE 'REVOKE "' || cdb_group_role || '" FROM "' || cdb_user_role || '"';
|
EXECUTE 'REVOKE "' || cdb_group_role || '" FROM "' || cdb_user_role || '"';
|
||||||
END
|
END
|
||||||
$$ LANGUAGE PLPGSQL;
|
$$ LANGUAGE PLPGSQL;
|
||||||
@ -65,7 +65,7 @@ FUNCTION cartodb.CDB_Group_Table_GrantRead(group_name text, username text, table
|
|||||||
DECLARE
|
DECLARE
|
||||||
cdb_group_role TEXT;
|
cdb_group_role TEXT;
|
||||||
BEGIN
|
BEGIN
|
||||||
cdb_group_role := cartodb.CDB_Group_GroupRole(group_name);
|
cdb_group_role := cartodb._CDB_Group_GroupRole(group_name);
|
||||||
EXECUTE 'GRANT USAGE ON SCHEMA "' || username || '" TO "' || cdb_group_role || '"';
|
EXECUTE 'GRANT USAGE ON SCHEMA "' || username || '" TO "' || cdb_group_role || '"';
|
||||||
EXECUTE 'GRANT SELECT ON TABLE "' || username || '"."' || table_name || '" TO "' || cdb_group_role || '"';
|
EXECUTE 'GRANT SELECT ON TABLE "' || username || '"."' || table_name || '" TO "' || cdb_group_role || '"';
|
||||||
END
|
END
|
||||||
@ -77,7 +77,7 @@ FUNCTION cartodb.CDB_Group_Table_RevokeAll(group_name text, username text, table
|
|||||||
DECLARE
|
DECLARE
|
||||||
cdb_group_role TEXT;
|
cdb_group_role TEXT;
|
||||||
BEGIN
|
BEGIN
|
||||||
cdb_group_role := cartodb.CDB_Group_GroupRole(group_name);
|
cdb_group_role := cartodb._CDB_Group_GroupRole(group_name);
|
||||||
EXECUTE 'REVOKE ALL ON TABLE "' || username || '"."' || table_name || '" FROM "' || cdb_group_role || '"';
|
EXECUTE 'REVOKE ALL ON TABLE "' || username || '"."' || table_name || '" FROM "' || cdb_group_role || '"';
|
||||||
END
|
END
|
||||||
$$ LANGUAGE PLPGSQL;
|
$$ LANGUAGE PLPGSQL;
|
||||||
@ -86,7 +86,7 @@ $$ LANGUAGE PLPGSQL;
|
|||||||
-- Private functions
|
-- Private functions
|
||||||
-----------------------
|
-----------------------
|
||||||
CREATE OR REPLACE
|
CREATE OR REPLACE
|
||||||
FUNCTION cartodb.CDB_Group_GroupRole(group_name text)
|
FUNCTION cartodb._CDB_Group_GroupRole(group_name text)
|
||||||
RETURNS TEXT AS $$
|
RETURNS TEXT AS $$
|
||||||
BEGIN
|
BEGIN
|
||||||
RETURN cartoDB.CDB_Organization_Member_Group_Role_Member_Name() || '_g_' || group_name;
|
RETURN cartoDB.CDB_Organization_Member_Group_Role_Member_Name() || '_g_' || group_name;
|
||||||
@ -95,7 +95,7 @@ $$ LANGUAGE PLPGSQL;
|
|||||||
|
|
||||||
-- Returns the first owner of the schema matching username. Organization user schemas must have one only owner.
|
-- Returns the first owner of the schema matching username. Organization user schemas must have one only owner.
|
||||||
CREATE OR REPLACE
|
CREATE OR REPLACE
|
||||||
FUNCTION cartodb.CDB_User_RoleFromUsername(username text)
|
FUNCTION cartodb._CDB_User_RoleFromUsername(username text)
|
||||||
RETURNS TEXT AS $$
|
RETURNS TEXT AS $$
|
||||||
DECLARE
|
DECLARE
|
||||||
user_role TEXT;
|
user_role TEXT;
|
||||||
|
Loading…
Reference in New Issue
Block a user