Exemple de création d’un rôle R/W avec les privileges.
CREATE ROLE "$GRP" nologin;
GRANT USAGE ON SCHEMA "$SCHE" TO "$GRP";
GRANT SELECT,UPDATE,INSERT,DELETE ON ALL TABLES IN SCHEMA "$SCHE" TO "$GRP";
GRANT USAGE ON ALL SEQUENCES IN SCHEMA "$SCHE" TO "$GRP";
GRANT EXECUTE ON ALL FUNCTIONS in SCHEMA "$SCHE" TO "$GRP";
ALTER DEFAULT PRIVILEGES IN SCHEMA "$SCHE" GRANT SELECT,UPDATE,INSERT,DELETE ON TABLES TO "$GRP";
ALTER DEFAULT PRIVILEGES IN SCHEMA "$SCHE" GRANT USAGE ON SEQUENCES TO "$GRP";
ALTER DEFAULT PRIVILEGES IN SCHEMA "$SCHE" GRANT EXECUTE ON FUNCTIONS TO "$GRP";
ALTER DEFAULT PRIVILEGES IN SCHEMA "$SCHE" GRANT USAGE ON TYPES TO "$GRP";
Laisser un commentaire