diff --git a/docs/content/Auth/Security-Context.mdx b/docs/content/Auth/Security-Context.mdx index 237a6ec8764f2..eafd54a9ea9f2 100644 --- a/docs/content/Auth/Security-Context.mdx +++ b/docs/content/Auth/Security-Context.mdx @@ -160,7 +160,7 @@ compiled. The following cube will ensure users only see results for their ```yaml cubes: - name: orders - sql_table: "{COMPILE_CONTEXT.securityContext.company_id}.orders" + sql_table: "{COMPILE_CONTEXT.security_context.company_id}.orders" measures: - name: count @@ -169,7 +169,7 @@ cubes: ```javascript cube(`orders`, { - sql_table: `${COMPILE_CONTEXT.securityContext.company_id}.orders`, + sql_table: `${COMPILE_CONTEXT.security_context.company_id}.orders`, measures: { count: { diff --git a/docs/content/Configuration/Advanced/Multitenancy.mdx b/docs/content/Configuration/Advanced/Multitenancy.mdx index f899d8b061c1e..d7943a37cbffc 100644 --- a/docs/content/Configuration/Advanced/Multitenancy.mdx +++ b/docs/content/Configuration/Advanced/Multitenancy.mdx @@ -94,13 +94,13 @@ module.exports = { return { type: 'athena', database: dataSource, - + // ... }; } else if (dataSource === 'googleAnalytics') { return { type: 'bigquery', - + // ... }; } else if (dataSource === 'financials') { @@ -114,7 +114,7 @@ module.exports = { } else { return { type: 'postgres', - + // ... }; } @@ -178,12 +178,12 @@ database, then each e-commerce store should be modeled as a separate tenant. ```yaml cubes: - name: products - sql_table: "{COMPILE_CONTEXT.securityContext.userId}.products" + sql_table: "{COMPILE_CONTEXT.security_context.userId}.products" ``` ```javascript cube(`products`, { - sql_table: `${COMPILE_CONTEXT.securityContext.userId}.products` + sql_table: `${COMPILE_CONTEXT.security_context.userId}.products` }); ``` diff --git a/docs/content/Schema/Reference/cube.mdx b/docs/content/Schema/Reference/cube.mdx index c66d446859c38..a0b9dc913bb4d 100644 --- a/docs/content/Schema/Reference/cube.mdx +++ b/docs/content/Schema/Reference/cube.mdx @@ -64,12 +64,12 @@ cubes: - name: organizations relationship: many_to_one sql: "{CUBE.organization_id} = {organizations.id}" - + measures: - name: count type: count sql: id - + dimensions: - name: organization_id sql: organization_id @@ -79,7 +79,7 @@ cubes: - name: created_at sql: created_at type: time - + - name: country sql: country type: string @@ -339,7 +339,7 @@ cube(`extended_order_facts`, { cubes: - name: order_facts sql_table: orders - + measures: - name: count type: count @@ -386,6 +386,40 @@ cube(`extended_order_facts`, { }); ``` +### <--{"id" : "Parameters"}--> public + + + +In previous versions of Cube, this property was called `shown`. + + + +The `public` property is used to manage the visibility of a cube. Valid values +for `public` are `true` and `false`. When set to `false`, this cube **cannot** +be queried through the API. Defaults to `true`. + + + +```javascript +cube(`orders`, { + sql_table: `public.orders`, + public: false, +}); +``` + +```yaml +cubes: + - name: orders + sql_table: public.orders + public: false +``` + + + +To learn more about using `public` to control visibility based on security +context, read the [Controlling access to cubes and views +recipe][ref-recipe-control-access-cubes-views]. + ### <--{"id" : "Parameters"}--> refresh_key Cube's caching layer uses `refresh_key` queries to get the current version of @@ -570,33 +604,6 @@ cubes: -### <--{"id" : "Parameters"}--> shown - -The `shown` property is used to manage the visibility of a cube. Valid values -for `shown` are `true` and `false`. - - - -```javascript -cube(`orders`, { - sql_table: `orders`, - shown: false, -}); -``` - -```yaml -cubes: - - name: orders - sql_table: orders - shown: false -``` - - - -To learn more about using `shown` to control visibility based on security -context, read the [Controlling access to cubes and views -recipe][ref-recipe-control-access-cubes-views]. - ### <--{"id" : "Parameters"}--> sql The `sql` parameter specifies the SQL that will be used to generate a table that @@ -1027,14 +1034,14 @@ value for different users. It may change however for different tenants. ```javascript cube(`users`, { - sql_table: `user_${COMPILE_CONTEXT.securityContext.deployment_id}.users`, + sql_table: `user_${COMPILE_CONTEXT.security_context.deployment_id}.users`, }); ``` ```yaml cubes: - name: users - sql_table: "user_{COMPILE_CONTEXT.securityContext.deployment_id}.users" + sql_table: "user_{COMPILE_CONTEXT.security_context.deployment_id}.users" ``` diff --git a/docs/content/Schema/Reference/dimensions.mdx b/docs/content/Schema/Reference/dimensions.mdx index 0e509c411c4a8..c155113fafc84 100644 --- a/docs/content/Schema/Reference/dimensions.mdx +++ b/docs/content/Schema/Reference/dimensions.mdx @@ -303,10 +303,17 @@ cubes: -### <--{"id" : "Parameters"}--> shown +### <--{"id" : "Parameters"}--> public -You can manage the visibility of the dimension using the `shown` property. The -default value of `shown` is `true`. + + +In previous versions of Cube, this property was called `shown`. + + + +The `public` property is used to manage the visibility of a dimension. Valid +values for `public` are `true` and `false`. When set to `false`, this dimension +**cannot** be queried through the API. Defaults to `true`. @@ -318,7 +325,7 @@ cube(`products`, { comment: { sql: `comments`, type: `string`, - shown: false, + public: false, }, }, }); @@ -332,7 +339,7 @@ cubes: dimensions: - name: comment sql: comments - type: string + public: false shown: false ``` diff --git a/docs/content/Schema/Reference/measures.mdx b/docs/content/Schema/Reference/measures.mdx index 44995ad95e12a..1cc5eba509e00 100644 --- a/docs/content/Schema/Reference/measures.mdx +++ b/docs/content/Schema/Reference/measures.mdx @@ -345,10 +345,17 @@ cubes: -### <--{"id" : "Parameters"}--> shown +### <--{"id" : "Parameters"}--> public -You can manage the visibility of the measure using the `shown` parameter. The -default value of `shown` is `true`. + + +In previous versions of Cube, this property was called `shown`. + + + +The `public` property is used to manage the visibility of a measure. Valid +values for `public` are `true` and `false`. When set to `false`, this measure +**cannot** be queried through the API. Defaults to `true`. @@ -360,7 +367,7 @@ cube(`orders`, { orders_count: { sql: `id`, type: `count`, - shown: false, + public: false, }, }, }); @@ -375,7 +382,7 @@ cubes: - name: orders_count sql: id type: count - shown: false + public: false ``` diff --git a/docs/content/Schema/Reference/segments.mdx b/docs/content/Schema/Reference/segments.mdx index 6163e1e2dec98..6b08e620b815e 100644 --- a/docs/content/Schema/Reference/segments.mdx +++ b/docs/content/Schema/Reference/segments.mdx @@ -139,6 +139,36 @@ cubes: +### <--{"id" : "Parameters"}--> public + +The `public` property is used to manage the visibility of a segment. Valid +values for `public` are `true` and `false`. When set to `false`, this segment +**cannot** be queried through the API. Defaults to `true`. + + + +```javascript +cube(`users`, { + segments: { + sf_users: { + sql: `${CUBE}.location = 'San Francisco'`, + public: false, + }, + }, +}); +``` + +```yaml +cubes: + - name: users + segments: + - name: sf_users + sql: "{CUBE}.location = 'San Francisco'" + public: false +``` + + + ### <--{"id" : "Parameters"}--> sql The `sql` parameter defines how a segment would filter out a subset of data. It diff --git a/docs/content/Schema/Reference/view.mdx b/docs/content/Schema/Reference/view.mdx index 440f2463a1091..040ee4e2af727 100644 --- a/docs/content/Schema/Reference/view.mdx +++ b/docs/content/Schema/Reference/view.mdx @@ -198,17 +198,24 @@ views: -### <--{"id" : "Parameters"}--> shown +### <--{"id" : "Parameters"}--> public -The `shown` property is used to manage the visibility of a view. Valid values -for `shown` are `true` and `false`. + + +In previous versions of Cube, this property was called `shown`. + + + +The `public` property is used to manage the visibility of a view. Valid values +for `public` are `true` and `false`. When set to `false`, this view **cannot** +be queried through the API. Defaults to `true`. ```javascript view(`arr`, { description: `Annual Recurring Revenue`, - shown: true, + public: COMPILE_CONTEXT.security_context.is_finance, includes: [ revenue.arr, @@ -222,7 +229,7 @@ view(`arr`, { views: - name: arr description: Annual Recurring Revenue - shown: "{COMPILE_CONTEXT.permissions.is_finance}", + public: COMPILE_CONTEXT.security_context.is_finance includes: # Measures @@ -234,7 +241,7 @@ views: -To learn more about using `shown` to control visibility based on security +To learn more about using `public` to control visibility based on security context, read the [Controlling access to cubes and views recipe][ref-recipe-control-access-cubes-views].