Last active
August 27, 2018 14:58
-
-
Save brycemcd/5558296 to your computer and use it in GitHub Desktop.
Postgres Role based permissions
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 characters
-- create user: | |
CREATE COLE user_name LOGIN PASSWORD 'password' SUPERUSER; | |
-- create role: | |
CREATE ROLE overlord; | |
-- grant role to user: | |
GRANT overlord TO user_name; | |
-- Not very many privs | |
GRANT SELECT ON ALL TABLES IN SCHEMA zz_test1 TO test2; | |
GRANT SELECT ON ALL SEQUENCES IN SCHEMA zz_test1 TO test2; | |
GRANT USAGE ON SCHEMA zz_test1 TO test2; | |
-- muchos privs | |
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA zz_test1 TO test1; | |
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA zz_test1 TO test1; | |
GRANT ALL ON SCHEMA zz_test1 TO test1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
not