Skip to content

Commit c8e451d

Browse files
authored
docs(modeling): document public property on cubes, views, dimensions, measures and segments (#6501)
1 parent ad3440d commit c8e451d

File tree

7 files changed

+114
-56
lines changed

7 files changed

+114
-56
lines changed

docs/content/Auth/Security-Context.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ compiled. The following cube will ensure users only see results for their
160160
```yaml
161161
cubes:
162162
- name: orders
163-
sql_table: "{COMPILE_CONTEXT.securityContext.company_id}.orders"
163+
sql_table: "{COMPILE_CONTEXT.security_context.company_id}.orders"
164164

165165
measures:
166166
- name: count
@@ -169,7 +169,7 @@ cubes:
169169
170170
```javascript
171171
cube(`orders`, {
172-
sql_table: `${COMPILE_CONTEXT.securityContext.company_id}.orders`,
172+
sql_table: `${COMPILE_CONTEXT.security_context.company_id}.orders`,
173173

174174
measures: {
175175
count: {

docs/content/Configuration/Advanced/Multitenancy.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,13 @@ module.exports = {
9494
return {
9595
type: 'athena',
9696
database: dataSource,
97-
97+
9898
// ...
9999
};
100100
} else if (dataSource === 'googleAnalytics') {
101101
return {
102102
type: 'bigquery',
103-
103+
104104
// ...
105105
};
106106
} else if (dataSource === 'financials') {
@@ -114,7 +114,7 @@ module.exports = {
114114
} else {
115115
return {
116116
type: 'postgres',
117-
117+
118118
// ...
119119
};
120120
}
@@ -178,12 +178,12 @@ database, then each e-commerce store should be modeled as a separate tenant.
178178
```yaml
179179
cubes:
180180
- name: products
181-
sql_table: "{COMPILE_CONTEXT.securityContext.userId}.products"
181+
sql_table: "{COMPILE_CONTEXT.security_context.userId}.products"
182182
```
183183
184184
```javascript
185185
cube(`products`, {
186-
sql_table: `${COMPILE_CONTEXT.securityContext.userId}.products`
186+
sql_table: `${COMPILE_CONTEXT.security_context.userId}.products`
187187
});
188188
```
189189

docs/content/Schema/Reference/cube.mdx

Lines changed: 40 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ cubes:
6464
- name: organizations
6565
relationship: many_to_one
6666
sql: "{CUBE.organization_id} = {organizations.id}"
67-
67+
6868
measures:
6969
- name: count
7070
type: count
7171
sql: id
72-
72+
7373
dimensions:
7474
- name: organization_id
7575
sql: organization_id
@@ -79,7 +79,7 @@ cubes:
7979
- name: created_at
8080
sql: created_at
8181
type: time
82-
82+
8383
- name: country
8484
sql: country
8585
type: string
@@ -339,7 +339,7 @@ cube(`extended_order_facts`, {
339339
cubes:
340340
- name: order_facts
341341
sql_table: orders
342-
342+
343343
measures:
344344
- name: count
345345
type: count
@@ -386,6 +386,40 @@ cube(`extended_order_facts`, {
386386
});
387387
```
388388

389+
### <--{"id" : "Parameters"}--> public
390+
391+
<InfoBox>
392+
393+
In previous versions of Cube, this property was called `shown`.
394+
395+
</InfoBox>
396+
397+
The `public` property is used to manage the visibility of a cube. Valid values
398+
for `public` are `true` and `false`. When set to `false`, this cube **cannot**
399+
be queried through the API. Defaults to `true`.
400+
401+
<CodeTabs>
402+
403+
```javascript
404+
cube(`orders`, {
405+
sql_table: `public.orders`,
406+
public: false,
407+
});
408+
```
409+
410+
```yaml
411+
cubes:
412+
- name: orders
413+
sql_table: public.orders
414+
public: false
415+
```
416+
417+
</CodeTabs>
418+
419+
To learn more about using `public` to control visibility based on security
420+
context, read the [Controlling access to cubes and views
421+
recipe][ref-recipe-control-access-cubes-views].
422+
389423
### <--{"id" : "Parameters"}--> refresh_key
390424

391425
Cube's caching layer uses `refresh_key` queries to get the current version of
@@ -570,33 +604,6 @@ cubes:
570604
571605
</CodeTabs>
572606
573-
### <--{"id" : "Parameters"}--> shown
574-
575-
The `shown` property is used to manage the visibility of a cube. Valid values
576-
for `shown` are `true` and `false`.
577-
578-
<CodeTabs>
579-
580-
```javascript
581-
cube(`orders`, {
582-
sql_table: `orders`,
583-
shown: false,
584-
});
585-
```
586-
587-
```yaml
588-
cubes:
589-
- name: orders
590-
sql_table: orders
591-
shown: false
592-
```
593-
594-
</CodeTabs>
595-
596-
To learn more about using `shown` to control visibility based on security
597-
context, read the [Controlling access to cubes and views
598-
recipe][ref-recipe-control-access-cubes-views].
599-
600607
### <--{"id" : "Parameters"}--> sql
601608
602609
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.
10271034

10281035
```javascript
10291036
cube(`users`, {
1030-
sql_table: `user_${COMPILE_CONTEXT.securityContext.deployment_id}.users`,
1037+
sql_table: `user_${COMPILE_CONTEXT.security_context.deployment_id}.users`,
10311038
});
10321039
```
10331040

10341041
```yaml
10351042
cubes:
10361043
- name: users
1037-
sql_table: "user_{COMPILE_CONTEXT.securityContext.deployment_id}.users"
1044+
sql_table: "user_{COMPILE_CONTEXT.security_context.deployment_id}.users"
10381045
```
10391046
10401047
</CodeTabs>

docs/content/Schema/Reference/dimensions.mdx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,17 @@ cubes:
303303
304304
</CodeTabs>
305305
306-
### <--{"id" : "Parameters"}--> shown
306+
### <--{"id" : "Parameters"}--> public
307307
308-
You can manage the visibility of the dimension using the `shown` property. The
309-
default value of `shown` is `true`.
308+
<InfoBox>
309+
310+
In previous versions of Cube, this property was called `shown`.
311+
312+
</InfoBox>
313+
314+
The `public` property is used to manage the visibility of a dimension. Valid
315+
values for `public` are `true` and `false`. When set to `false`, this dimension
316+
**cannot** be queried through the API. Defaults to `true`.
310317

311318
<CodeTabs>
312319

@@ -318,7 +325,7 @@ cube(`products`, {
318325
comment: {
319326
sql: `comments`,
320327
type: `string`,
321-
shown: false,
328+
public: false,
322329
},
323330
},
324331
});
@@ -332,7 +339,7 @@ cubes:
332339
dimensions:
333340
- name: comment
334341
sql: comments
335-
type: string
342+
public: false
336343
shown: false
337344
```
338345

docs/content/Schema/Reference/measures.mdx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -345,10 +345,17 @@ cubes:
345345
346346
</CodeTabs>
347347
348-
### <--{"id" : "Parameters"}--> shown
348+
### <--{"id" : "Parameters"}--> public
349349
350-
You can manage the visibility of the measure using the `shown` parameter. The
351-
default value of `shown` is `true`.
350+
<InfoBox>
351+
352+
In previous versions of Cube, this property was called `shown`.
353+
354+
</InfoBox>
355+
356+
The `public` property is used to manage the visibility of a measure. Valid
357+
values for `public` are `true` and `false`. When set to `false`, this measure
358+
**cannot** be queried through the API. Defaults to `true`.
352359

353360
<CodeTabs>
354361

@@ -360,7 +367,7 @@ cube(`orders`, {
360367
orders_count: {
361368
sql: `id`,
362369
type: `count`,
363-
shown: false,
370+
public: false,
364371
},
365372
},
366373
});
@@ -375,7 +382,7 @@ cubes:
375382
- name: orders_count
376383
sql: id
377384
type: count
378-
shown: false
385+
public: false
379386
```
380387
381388
</CodeTabs>

docs/content/Schema/Reference/segments.mdx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,36 @@ cubes:
139139
140140
</CodeTabs>
141141
142+
### <--{"id" : "Parameters"}--> public
143+
144+
The `public` property is used to manage the visibility of a segment. Valid
145+
values for `public` are `true` and `false`. When set to `false`, this segment
146+
**cannot** be queried through the API. Defaults to `true`.
147+
148+
<CodeTabs>
149+
150+
```javascript
151+
cube(`users`, {
152+
segments: {
153+
sf_users: {
154+
sql: `${CUBE}.location = 'San Francisco'`,
155+
public: false,
156+
},
157+
},
158+
});
159+
```
160+
161+
```yaml
162+
cubes:
163+
- name: users
164+
segments:
165+
- name: sf_users
166+
sql: "{CUBE}.location = 'San Francisco'"
167+
public: false
168+
```
169+
170+
</CodeTabs>
171+
142172
### <--{"id" : "Parameters"}--> sql
143173
144174
The `sql` parameter defines how a segment would filter out a subset of data. It

docs/content/Schema/Reference/view.mdx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,17 +198,24 @@ views:
198198
199199
</CodeTabs>
200200
201-
### <--{"id" : "Parameters"}--> shown
201+
### <--{"id" : "Parameters"}--> public
202202
203-
The `shown` property is used to manage the visibility of a view. Valid values
204-
for `shown` are `true` and `false`.
203+
<InfoBox>
204+
205+
In previous versions of Cube, this property was called `shown`.
206+
207+
</InfoBox>
208+
209+
The `public` property is used to manage the visibility of a view. Valid values
210+
for `public` are `true` and `false`. When set to `false`, this view **cannot**
211+
be queried through the API. Defaults to `true`.
205212

206213
<CodeTabs>
207214

208215
```javascript
209216
view(`arr`, {
210217
description: `Annual Recurring Revenue`,
211-
shown: true,
218+
public: COMPILE_CONTEXT.security_context.is_finance,
212219

213220
includes: [
214221
revenue.arr,
@@ -222,7 +229,7 @@ view(`arr`, {
222229
views:
223230
- name: arr
224231
description: Annual Recurring Revenue
225-
shown: "{COMPILE_CONTEXT.permissions.is_finance}",
232+
public: COMPILE_CONTEXT.security_context.is_finance
226233

227234
includes:
228235
# Measures
@@ -234,7 +241,7 @@ views:
234241
235242
</CodeTabs>
236243
237-
To learn more about using `shown` to control visibility based on security
244+
To learn more about using `public` to control visibility based on security
238245
context, read the [Controlling access to cubes and views
239246
recipe][ref-recipe-control-access-cubes-views].
240247

0 commit comments

Comments
 (0)