notes/postgres/user.sql

40 lines
1.1 KiB
MySQL
Raw Normal View History

2018-11-09 12:37:19 -05:00
DROP USER IF EXISTS report;
2018-11-08 23:48:56 -05:00
2018-11-09 12:37:19 -05:00
SET password_encryption = 'scram-sha-256';
2018-11-08 23:49:20 -05:00
2018-11-09 12:37:19 -05:00
CREATE ROLE report WITH
2018-11-08 23:48:56 -05:00
LOGIN
NOSUPERUSER
NOCREATEDB
NOCREATEROLE
INHERIT
NOREPLICATION
CONNECTION LIMIT -1
2018-11-09 12:37:19 -05:00
PASSWORD 'report';
2018-11-08 23:48:56 -05:00
--------------------grant--------------------------------------------------
2018-11-09 12:37:19 -05:00
GRANT USAGE ON SCHEMA lgdat TO report;
2018-11-08 23:48:56 -05:00
2018-11-09 12:37:19 -05:00
GRANT SELECT /*, UPDATE, INSERT, DELETE*/ ON ALL TABLES IN SCHEMA lgdat TO report;
2018-11-08 23:48:56 -05:00
2018-11-09 12:37:19 -05:00
GRANT USAGE ON ALL SEQUENCES IN SCHEMA lgdat TO report;
2018-11-08 23:48:56 -05:00
2018-11-09 12:37:19 -05:00
ALTER DEFAULT PRIVILEGES IN SCHEMA lgdat GRANT SELECT/*, UPDATE, INSERT, DELETE*/ ON TABLES TO report;
2018-11-08 23:48:56 -05:00
2018-11-09 12:37:19 -05:00
ALTER DEFAULT PRIVILEGES IN SCHEMA lgdat GRANT USAGE ON SEQUENCES TO report;
2018-11-08 23:48:56 -05:00
---------------------------revoke---------------------------------------
2018-11-09 12:37:19 -05:00
REVOKE USAGE ON SCHEMA lgdat FROM report;
2018-11-08 23:48:56 -05:00
2018-11-09 12:37:19 -05:00
REVOKE USAGE ON SCHEMA lgdat FROM report;
2018-11-08 23:48:56 -05:00
2018-11-09 12:37:19 -05:00
REVOKE SELECT , UPDATE, INSERT, DELETE ON ALL TABLES IN SCHEMA lgdat FROM report;
2018-11-08 23:48:56 -05:00
2018-11-09 12:37:19 -05:00
REVOKE USAGE ON ALL SEQUENCES IN SCHEMA lgdat FROM report;
2018-11-08 23:48:56 -05:00
2018-11-09 12:37:19 -05:00
ALTER DEFAULT PRIVILEGES IN SCHEMA lgdat REVOKE SELECT, UPDATE, INSERT, DELETE ON TABLES FROM report;
2018-11-08 23:48:56 -05:00
2018-11-30 00:21:01 -05:00
ALTER DEFAULT PRIVILEGES IN SCHEMA lgdat REVOKE USAGE ON SEQUENCES FROM report;