|
1 | 1 | BEGIN;
|
| 2 | +-- create net extension as supabase_admin |
2 | 3 | create extension if not exists pg_net with schema "extensions";
|
| 4 | + |
| 5 | +-- \ir migrations/db/init-scripts/00000000000003-post-setup.sql |
| 6 | +grant usage on schema net TO postgres, anon, authenticated, service_role; |
| 7 | +alter function net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) security definer; |
| 8 | +alter function net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) security definer; |
| 9 | +alter function net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) SET search_path = net; |
| 10 | +alter function net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) SET search_path = net; |
| 11 | +revoke all on function net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) from public; |
| 12 | +revoke all on function net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) from public; |
| 13 | +grant execute on function net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds integer) TO postgres, anon, authenticated, service_role; |
| 14 | +grant execute on function net.http_post(url text, body jsonb, params jsonb, headers jsonb, timeout_milliseconds integer) TO postgres, anon, authenticated, service_role; |
| 15 | + |
| 16 | +-- postgres role should have access |
| 17 | +set local role postgres; |
| 18 | +select net.http_get('http://localhost', null::jsonb, null::jsonb, 100); |
| 19 | + |
| 20 | +-- authenticated role should have access |
| 21 | +set local role authenticated; |
| 22 | +select net.http_get('http://localhost', null::jsonb, null::jsonb, 100); |
3 | 23 | ROLLBACK;
|
0 commit comments