How to completely disable specific root fields for a table in Hasura #9604
-
Hello everyone, I'm trying to disable specific root fields for a table in Hasura. In my case, I want to completely remove the _aggregate root field from the generated GraphQL schema, as I don't need it in my application. I've tried the following approaches based on the Table Config and Custom Root Fields documentation: Setting the select_aggregate field to an empty string (""):
Setting the select_aggregate field to null:
However, none of these approaches seem to completely remove the _aggregate root field from the GraphQL schema. It's still visible and accessible through the Hasura console. Is there a way to completely disable specific root fields, like _aggregate, for a table in Hasura? Any help or guidance would be appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hello @valterartur I assume you are familiar with "roles" and "permissions". For the best practices, secure your GraphQL API with authorization using roles and permissions -https://hasura.io/docs/latest/auth/authorization/index/ Once you've set roles and permissions for it, let's say any user accessing your API has a specific role attached to them. Say a user with role "moderator" accesses your GraphQL API and you don't want to show them Check the image I've attached here so you'll get the idea. Please do try this and let me know if you are still facing issues |
Beta Was this translation helpful? Give feedback.
-
Hi @meetzaveri . |
Beta Was this translation helpful? Give feedback.
Right, there's no way. If you are exposing them via admin role, its not considered a good practice. Your end users should always be accessing your graphql endpoint with some seperate role(where certain data needs to be restricted for them).