add postgres folder and script to create user
This commit is contained in:
parent
9c8175a409
commit
0bd574cb5c
BIN
.tmux.md.swp
Normal file
BIN
.tmux.md.swp
Normal file
Binary file not shown.
1
postgres/psql.md
Normal file
1
postgres/psql.md
Normal file
@ -0,0 +1 @@
|
||||
use -E to show definitions of SQL used for \d commands
|
37
user.sql
Normal file
37
user.sql
Normal file
@ -0,0 +1,37 @@
|
||||
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;
|
Loading…
Reference in New Issue
Block a user