Non-public API method naming
This commit is contained in:
parent
e04f0caa6c
commit
b633466724
@ -5,7 +5,7 @@ DECLARE
|
||||
cdb_group_role TEXT;
|
||||
BEGIN
|
||||
-- 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 )
|
||||
THEN
|
||||
EXECUTE 'CREATE ROLE "' || cdb_group_role || '" NOLOGIN;';
|
||||
@ -19,8 +19,8 @@ CREATE OR REPLACE
|
||||
FUNCTION cartodb.CDB_Group_DropGroup(group_name text)
|
||||
RETURNS VOID AS $$
|
||||
BEGIN
|
||||
EXECUTE 'DROP OWNED BY "' || cartodb.CDB_Group_GroupRole(group_name) || '"';
|
||||
EXECUTE 'DROP ROLE IF EXISTS "' || 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) || '"';
|
||||
END
|
||||
$$ LANGUAGE PLPGSQL;
|
||||
|
||||
@ -29,7 +29,7 @@ CREATE OR REPLACE
|
||||
FUNCTION cartodb.CDB_Group_RenameGroup(old_group_name text, new_group_name text)
|
||||
RETURNS VOID AS $$
|
||||
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
|
||||
$$ LANGUAGE PLPGSQL;
|
||||
|
||||
@ -40,8 +40,8 @@ DECLARE
|
||||
cdb_group_role TEXT;
|
||||
cdb_user_role TEXT;
|
||||
BEGIN
|
||||
cdb_group_role := cartodb.CDB_Group_GroupRole(group_name);
|
||||
cdb_user_role := cartodb.CDB_User_RoleFromUsername(username);
|
||||
cdb_group_role := cartodb._CDB_Group_GroupRole(group_name);
|
||||
cdb_user_role := cartodb._CDB_User_RoleFromUsername(username);
|
||||
EXECUTE 'GRANT "' || cdb_group_role || '" TO "' || cdb_user_role || '"';
|
||||
END
|
||||
$$ LANGUAGE PLPGSQL;
|
||||
@ -53,8 +53,8 @@ DECLARE
|
||||
cdb_group_role TEXT;
|
||||
cdb_user_role TEXT;
|
||||
BEGIN
|
||||
cdb_group_role := cartodb.CDB_Group_GroupRole(group_name);
|
||||
cdb_user_role := cartodb.CDB_User_RoleFromUsername(username);
|
||||
cdb_group_role := cartodb._CDB_Group_GroupRole(group_name);
|
||||
cdb_user_role := cartodb._CDB_User_RoleFromUsername(username);
|
||||
EXECUTE 'REVOKE "' || cdb_group_role || '" FROM "' || cdb_user_role || '"';
|
||||
END
|
||||
$$ LANGUAGE PLPGSQL;
|
||||
@ -65,7 +65,7 @@ FUNCTION cartodb.CDB_Group_Table_GrantRead(group_name text, username text, table
|
||||
DECLARE
|
||||
cdb_group_role TEXT;
|
||||
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 SELECT ON TABLE "' || username || '"."' || table_name || '" TO "' || cdb_group_role || '"';
|
||||
END
|
||||
@ -77,7 +77,7 @@ FUNCTION cartodb.CDB_Group_Table_RevokeAll(group_name text, username text, table
|
||||
DECLARE
|
||||
cdb_group_role TEXT;
|
||||
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 || '"';
|
||||
END
|
||||
$$ LANGUAGE PLPGSQL;
|
||||
@ -86,7 +86,7 @@ $$ LANGUAGE PLPGSQL;
|
||||
-- Private functions
|
||||
-----------------------
|
||||
CREATE OR REPLACE
|
||||
FUNCTION cartodb.CDB_Group_GroupRole(group_name text)
|
||||
FUNCTION cartodb._CDB_Group_GroupRole(group_name text)
|
||||
RETURNS TEXT AS $$
|
||||
BEGIN
|
||||
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.
|
||||
CREATE OR REPLACE
|
||||
FUNCTION cartodb.CDB_User_RoleFromUsername(username text)
|
||||
FUNCTION cartodb._CDB_User_RoleFromUsername(username text)
|
||||
RETURNS TEXT AS $$
|
||||
DECLARE
|
||||
user_role TEXT;
|
||||
|
Loading…
Reference in New Issue
Block a user