Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Docs query definition visibility (#86098)

Rodrigo López Dato004e5db409fd
diff --git a/docs/permissions/collections.md b/docs/permissions/collections.md
index e83a4125fd9..82129f71aa5 100644
--- a/docs/permissions/collections.md
+++ b/docs/permissions/collections.md
@@ -46,7 +46,9 @@ The group won't see this collection listed, and they'll lack access to any of th
Collection permissions only apply to viewing and curating existing questions, models, and dashboards. Changing the query on an existing question, or creating a new question, requires that the group have [data permissions](./data.md) for the underlying data.
-There is one, important exception: when a group has their data permission set to [Block](./data.md#blocked-view-data-permission) for a database or table, the group won't be able to view questions based on that data, even if they have curate access to the collection where those questions are saved.
+View access to a collection includes access to the query definition of each item saved in it, including the SQL of native questions. If a group can view a question, they can see how that question was built, including through the [Metabase API](../api.html). This is true even if they lack [Create queries](./data.md#create-queries-permissions) permissions for the underlying data, and even if they can't run the query themselves. If you don't want a group to see a query, don't give them access to the collection where that query is saved.
+
+When a group has their data permission set to [Blocked](./data.md#blocked-view-data-permission) for a database or table, the group won't be able to view questions based on that data, even if they have curate access to the collection where those questions are saved.
## Dashboards with questions from multiple collections
diff --git a/docs/permissions/data.md b/docs/permissions/data.md
index 825694d8356..b979a36a9f8 100644
--- a/docs/permissions/data.md
+++ b/docs/permissions/data.md
@@ -113,6 +113,8 @@ See [impersonated view data permissions](./impersonation.md)
**Blocked** ensures people in a group can’t see the data from this database, schema, or table, regardless of their permissions at the collection level.
+Blocked applies to the data. It stops a group from seeing results, and it doesn't hide the query definitions of questions that the group can otherwise view. Query definitions follow [collection permissions](./collections.md#collection-vs-data-permissions).
+
The Blocked view data permission can be set at the database, schema, or table level. Essentially, what Blocked does is make collections permissions _insufficient_ to view a question. For example, even if a question is in a collection that the group has access to, but that question queries a data source that is Blocked for that group, people in that group won't be able to view that question _unless_ they're in another group with the data permissions to that data source.
Setting blocked access for a group ALWAYS prevents the group from viewing questions built with the native query editor that query ANY tables from the same database. So even if you only block a single table in a database, the group won't be able to view the results of SQL questions that query ANY table in that database. The reason: Metabase doesn't (yet) parse SQL queries, so it can't know for sure whether the SQL queries the table you want to block.
@@ -125,6 +127,8 @@ Specifies whether a group can create new questions based on the data source. Cre
To enable Create queries permissions for a group, that group must be able to view the data source ("Can view" permission.)
+Create queries permissions control who can write and run queries. They don't hide the queries behind questions that already exist. A group without native query permissions can't write SQL, and won't see the **View SQL** button in the query builder, but they can still read the SQL of a saved native question in a collection they have access to. Metabase returns a question's query definition to anyone who can view that question. See [Collection vs data permissions](./collections.md#collection-vs-data-permissions).
+
Create query levels include:
### Query builder and native create queries permission