From 5e28417b3db8218bdbb985defb5a6db75ac2fce9 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Mon, 5 May 2014 18:04:14 +0200 Subject: [PATCH] Add "cdb_org_admin" and "cdb_org_user" roles as part of extension --- Makefile | 5 ++++- scripts-available/CDB_Roles.sql | 13 +++++++++++++ scripts-enabled/000-CDB_Roles.sql | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 scripts-available/CDB_Roles.sql create mode 120000 scripts-enabled/000-CDB_Roles.sql diff --git a/Makefile b/Makefile index 750c891..ab668ad 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,9 @@ PGXS := $(shell $(PG_CONFIG) --pgxs) include $(PGXS) $(EXTENSION)--$(EXTVERSION).sql: $(CDBSCRIPTS) cartodb_hooks.sql Makefile - cat $(CDBSCRIPTS) | sed 's/\ $@ + echo "SET search_path TO cartodb,public,pg_catalog;" > $@ + cat $(CDBSCRIPTS) | \ + sed -e 's/\> $@ echo "GRANT USAGE ON SCHEMA cartodb TO public;" >> $@ cat cartodb_hooks.sql >> $@ diff --git a/scripts-available/CDB_Roles.sql b/scripts-available/CDB_Roles.sql new file mode 100644 index 0000000..c984d3c --- /dev/null +++ b/scripts-available/CDB_Roles.sql @@ -0,0 +1,13 @@ +DO LANGUAGE 'plpgsql' $$ +BEGIN + IF NOT EXISTS ( SELECT * FROM pg_roles WHERE rolname= 'cdb_org_admin' ) + THEN + CREATE ROLE cdb_org_admin NOLOGIN; + END IF; + + IF NOT EXISTS ( SELECT * FROM pg_roles WHERE rolname= 'cdb_org_user' ) + THEN + CREATE ROLE cdb_org_user NOLOGIN; + END IF; +END +$$; diff --git a/scripts-enabled/000-CDB_Roles.sql b/scripts-enabled/000-CDB_Roles.sql new file mode 120000 index 0000000..793ce20 --- /dev/null +++ b/scripts-enabled/000-CDB_Roles.sql @@ -0,0 +1 @@ +../scripts-available/CDB_Roles.sql \ No newline at end of file