Skip to content

Instantly share code, notes, and snippets.

@ChronSyn
Created July 24, 2022 02:48
Show Gist options
  • Save ChronSyn/1e3b79f0deb822944cad8328fa97cdb3 to your computer and use it in GitHub Desktop.
Save ChronSyn/1e3b79f0deb822944cad8328fa97cdb3 to your computer and use it in GitHub Desktop.
Hasura - allow only select access to root queries
# SourceNameGoesHere = the name as it appears in Hasura dashboard
# See example: https://twitter.com/ChronSyn/status/1551035751512657921/photo/1
curl --location --request POST 'https://[your-hasura-address-dot-com]/v1/metadata' \
--header 'x-hasura-admin-secret: <your hasura admin secret>' \
--header 'X-Hasura-Role: admin' \
--header 'Content-Type: application/json' \
--data-raw '{
"type" : "pg_create_select_permission",
"args" : {
"table" : {
"name": "name_of_your_table",
"schema": "schema_of_your_table"
},
"role" : "public",
"source": "SourceNameGoesHere",
"permission" : {
"columns" : "*",
"filter" : {},
"query_root_fields": ["select"],
"subscription_root_fields": []
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment