Add "cdb_org_admin" and "cdb_org_user" roles as part of extension

This commit is contained in:
Sandro Santilli 2014-05-05 18:04:14 +02:00
parent 2f1fdf5a15
commit 5e28417b3d
3 changed files with 18 additions and 1 deletions

View File

@ -16,6 +16,9 @@ PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
$(EXTENSION)--$(EXTVERSION).sql: $(CDBSCRIPTS) cartodb_hooks.sql Makefile
cat $(CDBSCRIPTS) | sed 's/\<public\./cartodb./g' > $@
echo "SET search_path TO cartodb,public,pg_catalog;" > $@
cat $(CDBSCRIPTS) | \
sed -e 's/\<public\./cartodb./g' \
-e 's/:DATABASE_USERNAME/cdb_org_admin/g' >> $@
echo "GRANT USAGE ON SCHEMA cartodb TO public;" >> $@
cat cartodb_hooks.sql >> $@

View File

@ -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
$$;

View File

@ -0,0 +1 @@
../scripts-available/CDB_Roles.sql