2018-11-08 23:48:56 -05:00
|
|
|
DROP USER IF EXISTS api;
|
|
|
|
|
2018-11-08 23:49:20 -05:00
|
|
|
SET password_encryption = 'md5' /* ='scram' */;
|
|
|
|
|
2018-11-08 23:48:56 -05:00
|
|
|
CREATE ROLE api WITH
|
|
|
|
LOGIN
|
|
|
|
NOSUPERUSER
|
|
|
|
NOCREATEDB
|
|
|
|
NOCREATEROLE
|
|
|
|
INHERIT
|
|
|
|
NOREPLICATION
|
|
|
|
CONNECTION LIMIT -1
|
|
|
|
PASSWORD '';
|
|
|
|
|
|
|
|
--------------------grant--------------------------------------------------
|
|
|
|
|
|
|
|
GRANT USAGE ON SCHEMA tps TO api;
|
|
|
|
|
|
|
|
GRANT SELECT/*, UPDATE, INSERT, DELETE*/ ON ALL TABLES IN SCHEMA tps TO api;
|
|
|
|
|
|
|
|
GRANT USAGE ON ALL SEQUENCES IN SCHEMA tps TO api;
|
|
|
|
|
|
|
|
ALTER DEFAULT PRIVILEGES IN SCHEMA tps GRANT SELECT/*, UPDATE, INSERT, DELETE*/ ON TABLES TO api;
|
|
|
|
|
|
|
|
ALTER DEFAULT PRIVILEGES IN SCHEMA tps GRANT USAGE ON SEQUENCES TO api;
|
|
|
|
|
|
|
|
---------------------------revoke---------------------------------------
|
|
|
|
|
|
|
|
REVOKE USAGE ON SCHEMA tps FROM api;
|
|
|
|
|
|
|
|
REVOKE USAGE ON SCHEMA tps FROM api;
|
|
|
|
|
2018-11-08 23:49:20 -05:00
|
|
|
REVOKE SELECT , UPDATE, INSERT, DELETE ON ALL TABLES IN SCHEMA tps FROM api;
|
2018-11-08 23:48:56 -05:00
|
|
|
|
|
|
|
REVOKE USAGE ON ALL SEQUENCES IN SCHEMA tps FROM api;
|
|
|
|
|
2018-11-08 23:49:20 -05:00
|
|
|
ALTER DEFAULT PRIVILEGES IN SCHEMA tps REVOKE SELECT, UPDATE, INSERT, DELETE ON TABLES FROM api;
|
2018-11-08 23:48:56 -05:00
|
|
|
|
|
|
|
ALTER DEFAULT PRIVILEGES IN SCHEMA tps REVOKE USAGE ON SEQUENCES FROM api;
|