Last active
July 17, 2018 13:24
Revisions
-
coder4web revised this gist
Jul 17, 2018 . 1 changed file with 17 additions and 4 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,20 @@ GRANT ALL ON ALL TABLES IN SCHEMA public TO admin_user; GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO admin_user; -- Read-only access CREATE ROLE readonly; -- grant access to all existing tables GRANT CONNECT ON DATABASE shop TO readonly; GRANT USAGE ON SCHEMA public TO readonly; GRANT SELECT ON ALL TABLES IN SCHEMA public TO readonly; GRANT SELECT ON ALL SEQUENCES IN SCHEMA public TO readonly; GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA public TO readonly; -- grant access to all table which will be created in the future ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readonly; ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON SEQUENCES TO readonly; ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT EXECUTE ON FUNCTIONS TO readonly; -- create user and grant role to this user CREATE USER b_readonly WITH PASSWORD 'reAdOnLy123'; GRANT readonly TO b_readonly; -
coder4web revised this gist
Jul 17, 2018 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ \z -- Full access GRANT ALL privileges ON DATABASE db TO admin_user; GRANT ALL ON schema public TO admin_user; -
coder4web revised this gist
Jul 17, 2018 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ -- Full access GRANT ALL privileges ON DATABASE db TO admin_user; GRANT ALL ON schema public TO admin_user; GRANT ALL ON ALL TABLES IN SCHEMA public TO admin_user; GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO admin_user; -
coder4web renamed this gist
Jul 17, 2018 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
coder4web renamed this gist
Jul 17, 2018 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
coder4web created this gist
Jul 17, 2018 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ -- Full access GRANT ALL ON schema public TO admin_user; GRANT ALL ON ALL TABLES IN SCHEMA public TO admin_user; GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO admin_user; -- Read-only access GRANT USAGE ON SCHEMA public TO read_user; GRANT SELECT ON ALL TABLES IN SCHEMA public TO read_user; GRANT SELECT ON ALL SEQUENCES IN SCHEMA public TO read_user; GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA public TO read_user;