aboutsummaryrefslogtreecommitdiffstats
path: root/postgrest/migrations/003-roles.sql
diff options
context:
space:
mode:
Diffstat (limited to 'postgrest/migrations/003-roles.sql')
-rw-r--r--postgrest/migrations/003-roles.sql15
1 files changed, 15 insertions, 0 deletions
diff --git a/postgrest/migrations/003-roles.sql b/postgrest/migrations/003-roles.sql
new file mode 100644
index 0000000..86e49f0
--- /dev/null
+++ b/postgrest/migrations/003-roles.sql
@@ -0,0 +1,15 @@
+-- authenticator role
+create role authenticator noinherit login password 'mysecretpassword';
+
+-- web_anon role
+create role web_anon nologin;
+grant usage on schema api to web_anon;
+grant web_anon to authenticator;
+-- grant select on api.todos to web_anon;
+
+-- todo_user role
+create role todo_user nologin;
+grant usage on schema api to todo_user;
+grant all on api.todos to todo_user;
+grant usage, select on sequence api.todos_id_seq to todo_user;
+grant todo_user to authenticator;