Skip to content

Commit a409f47

Browse files
committed
Grant Hasura user additional privileges.
1 parent 78079e5 commit a409f47

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

azuredbmock/00-initialize.sql

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,16 @@ CREATE EXTENSION IF NOT EXISTS btree_gist;
2424
-- allow hasura to create new schemas
2525
GRANT CREATE ON DATABASE xxx_db_hasura_name_xxx TO xxx_db_hasura_username_xxx;
2626

27-
-- grant usage access to the public schema to the hasura user
28-
GRANT USAGE ON SCHEMA public TO xxx_db_hasura_username_xxx;
27+
-- grant select permissions on information_schema and pg_catalog to the hasura
28+
-- user
29+
GRANT SELECT ON ALL TABLES IN SCHEMA information_schema TO xxx_db_hasura_username_xxx;
30+
GRANT SELECT ON ALL TABLES IN SCHEMA pg_catalog TO xxx_db_hasura_username_xxx;
31+
32+
-- grant all privileges on all tables in the public schema to the hasura user
33+
GRANT ALL ON SCHEMA public TO xxx_db_hasura_username_xxx;
34+
GRANT ALL ON ALL TABLES IN SCHEMA public TO xxx_db_hasura_username_xxx;
35+
GRANT ALL ON ALL SEQUENCES IN SCHEMA public TO xxx_db_hasura_username_xxx;
36+
GRANT ALL ON ALL FUNCTIONS IN SCHEMA public TO xxx_db_hasura_username_xxx;
2937

3038
-- create database for auth and give ALL privileges to auth db user
3139
CREATE DATABASE xxx_db_auth_name_xxx;
@@ -75,6 +83,17 @@ ALTER SCHEMA public OWNER TO CURRENT_USER;
7583
CREATE EXTENSION IF NOT EXISTS pgcrypto;
7684
CREATE EXTENSION IF NOT EXISTS btree_gist;
7785

86+
-- grant select permissions on information_schema and pg_catalog to the hasura
87+
-- user
88+
GRANT SELECT ON ALL TABLES IN SCHEMA information_schema TO xxx_db_hasura_username_xxx;
89+
GRANT SELECT ON ALL TABLES IN SCHEMA pg_catalog TO xxx_db_hasura_username_xxx;
90+
91+
-- grant all privileges on all tables in the public schema to the hasura user
92+
GRANT ALL ON SCHEMA public TO xxx_db_hasura_username_xxx;
93+
GRANT ALL ON ALL TABLES IN SCHEMA public TO xxx_db_hasura_username_xxx;
94+
GRANT ALL ON ALL SEQUENCES IN SCHEMA public TO xxx_db_hasura_username_xxx;
95+
GRANT ALL ON ALL FUNCTIONS IN SCHEMA public TO xxx_db_hasura_username_xxx;
96+
7897
-- grant usage to the public schema to the timetables-api user
7998
GRANT USAGE ON SCHEMA public TO xxx_db_timetables_api_username_xxx;
8099

0 commit comments

Comments
 (0)