diff --git a/postgres/user.sql b/postgres/user.sql new file mode 100644 index 0000000..715756f --- /dev/null +++ b/postgres/user.sql @@ -0,0 +1,37 @@ +DROP USER IF EXISTS api; + +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; + +REVOKE SELECT /*, UPDATE, INSERT, DELETE*/ ON ALL TABLES IN SCHEMA tps FROM api; + +REVOKE USAGE ON ALL SEQUENCES IN SCHEMA tps FROM api; + +ALTER DEFAULT PRIVILEGES IN SCHEMA tps REVOKE SELECT/*, UPDATE, INSERT, DELETE*/ ON TABLES FROM api; + +ALTER DEFAULT PRIVILEGES IN SCHEMA tps REVOKE USAGE ON SEQUENCES FROM api; \ No newline at end of file diff --git a/user.sql b/user.sql deleted file mode 100644 index e43a361..0000000 --- a/user.sql +++ /dev/null @@ -1,37 +0,0 @@ -DROP USER IF EXISTS salesreader; - -CREATE ROLE salesreader WITH - LOGIN - NOSUPERUSER - NOCREATEDB - NOCREATEROLE - INHERIT - NOREPLICATION - CONNECTION LIMIT -1 - ENCRYPTED PASSWORD 'md5b66677418e59ca921c20ff40534685a7'; - ---------------------grant-------------------------------------------------- - -GRANT USAGE ON SCHEMA rlarp TO salesreader; - -GRANT SELECT /*, UPDATE, INSERT, DELETE*/ ON ALL TABLES IN SCHEMA rlarp TO salesreader; - -GRANT USAGE ON ALL SEQUENCES IN SCHEMA rlarp TO salesreader; - -ALTER DEFAULT PRIVILEGES IN SCHEMA rlarp GRANT SELECT/*, UPDATE, INSERT, DELETE*/ ON TABLES TO salesreader; - -ALTER DEFAULT PRIVILEGES IN SCHEMA rlarp GRANT USAGE ON SEQUENCES TO salesreader; - ----------------------------revoke--------------------------------------- - -REVOKE USAGE ON SCHEMA tps FROM salesreader; - -REVOKE USAGE ON SCHEMA rlarp FROM salesreader; - -REVOKE SELECT /*, UPDATE, INSERT, DELETE*/ ON ALL TABLES IN SCHEMA rlarp FROM salesreader; - -REVOKE USAGE ON ALL SEQUENCES IN SCHEMA rlarp FROM salesreader; - -ALTER DEFAULT PRIVILEGES IN SCHEMA rlarp REVOKE SELECT/*, UPDATE, INSERT, DELETE*/ ON TABLES FROM salesreader; - -ALTER DEFAULT PRIVILEGES IN SCHEMA rlarp REVOKE USAGE ON SEQUENCES FROM salesreader; \ No newline at end of file