|
|
|
@ -16,7 +16,7 @@ SET standard_conforming_strings = off;
|
|
|
|
|
SET check_function_bodies = false;
|
|
|
|
|
SET client_min_messages = warning;
|
|
|
|
|
SET escape_string_warning = off;
|
|
|
|
|
SET search_path = public, pg_catalog;
|
|
|
|
|
SET search_path = public, cartodb, pg_catalog;
|
|
|
|
|
SET default_tablespace = '';
|
|
|
|
|
SET default_with_oids = false;
|
|
|
|
|
|
|
|
|
@ -160,6 +160,8 @@ DROP USER IF EXISTS :PUBLICUSER;
|
|
|
|
|
CREATE USER :PUBLICUSER WITH PASSWORD ':PUBLICPASS';
|
|
|
|
|
ALTER ROLE :PUBLICUSER SET statement_timeout = 2000;
|
|
|
|
|
GRANT SELECT ON TABLE scoped_table_1 TO :PUBLICUSER;
|
|
|
|
|
GRANT USAGE ON SCHEMA cartodb TO :PUBLICUSER;
|
|
|
|
|
GRANT ALL ON CDB_TableMetadata TO :PUBLICUSER;
|
|
|
|
|
|
|
|
|
|
-- regular user role 1
|
|
|
|
|
DROP USER IF EXISTS regular_1;
|
|
|
|
@ -168,22 +170,31 @@ ALTER ROLE regular_1 SET statement_timeout = 2000;
|
|
|
|
|
|
|
|
|
|
GRANT ALL ON TABLE scoped_table_1 TO regular_1;
|
|
|
|
|
GRANT ALL ON SEQUENCE scoped_table_1_cartodb_id_seq TO regular_1;
|
|
|
|
|
GRANT USAGE ON SCHEMA cartodb TO regular_1;
|
|
|
|
|
GRANT ALL ON CDB_TableMetadata TO regular_1;
|
|
|
|
|
|
|
|
|
|
-- regular user role 2
|
|
|
|
|
DROP USER IF EXISTS regular_2;
|
|
|
|
|
CREATE USER regular_2 WITH PASSWORD 'regular2';
|
|
|
|
|
ALTER ROLE regular_2 SET statement_timeout = 2000;
|
|
|
|
|
GRANT USAGE ON SCHEMA cartodb TO regular_2;
|
|
|
|
|
GRANT ALL ON CDB_TableMetadata TO regular_2;
|
|
|
|
|
|
|
|
|
|
-- fallback user role
|
|
|
|
|
DROP USER IF EXISTS test_cartodb_user_2;
|
|
|
|
|
CREATE USER test_cartodb_user_2 WITH PASSWORD 'test_cartodb_user_2_pass';
|
|
|
|
|
GRANT ALL ON TABLE scoped_table_1 TO test_cartodb_user_2;
|
|
|
|
|
GRANT ALL ON SEQUENCE scoped_table_1_cartodb_id_seq TO test_cartodb_user_2;
|
|
|
|
|
GRANT USAGE ON SCHEMA cartodb TO test_cartodb_user_2;
|
|
|
|
|
GRANT ALL ON CDB_TableMetadata TO test_cartodb_user_2;
|
|
|
|
|
|
|
|
|
|
-- db owner role
|
|
|
|
|
DROP USER IF EXISTS :TESTUSER;
|
|
|
|
|
CREATE USER :TESTUSER WITH PASSWORD ':TESTPASS';
|
|
|
|
|
|
|
|
|
|
GRANT USAGE ON SCHEMA cartodb TO :TESTUSER;
|
|
|
|
|
GRANT ALL ON CDB_TableMetadata TO :TESTUSER;
|
|
|
|
|
|
|
|
|
|
GRANT ALL ON TABLE untitle_table_4 TO :TESTUSER;
|
|
|
|
|
GRANT SELECT ON TABLE untitle_table_4 TO :PUBLICUSER;
|
|
|
|
|
GRANT ALL ON TABLE private_table TO :TESTUSER;
|
|
|
|
@ -205,12 +216,6 @@ GRANT ALL ON TABLE cpg_test TO :TESTUSER;
|
|
|
|
|
GRANT SELECT ON TABLE cpg_test TO :PUBLICUSER;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS
|
|
|
|
|
CDB_TableMetadata (
|
|
|
|
|
tabname regclass not null primary key,
|
|
|
|
|
updated_at timestamp with time zone not null default now()
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
INSERT INTO CDB_TableMetadata (tabname, updated_at) VALUES ('untitle_table_4'::regclass, '2014-01-01T23:31:30.123Z');
|
|
|
|
|
INSERT INTO CDB_TableMetadata (tabname, updated_at) VALUES ('private_table'::regclass, '2015-01-01T23:31:30.123Z');
|
|
|
|
|
INSERT INTO CDB_TableMetadata (tabname, updated_at) VALUES ('scoped_table_1'::regclass, '2015-01-01T23:31:30.123Z');
|
|
|
|
|