Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/content/Auth/Security-Context.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: {
Expand Down
10 changes: 5 additions & 5 deletions docs/content/Configuration/Advanced/Multitenancy.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ module.exports = {
return {
type: 'athena',
database: dataSource,

// ...
};
} else if (dataSource === 'googleAnalytics') {
return {
type: 'bigquery',

// ...
};
} else if (dataSource === 'financials') {
Expand All @@ -114,7 +114,7 @@ module.exports = {
} else {
return {
type: 'postgres',

// ...
};
}
Expand Down Expand Up @@ -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`
});
```

Expand Down
73 changes: 40 additions & 33 deletions docs/content/Schema/Reference/cube.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -79,7 +79,7 @@ cubes:
- name: created_at
sql: created_at
type: time

- name: country
sql: country
type: string
Expand Down Expand Up @@ -339,7 +339,7 @@ cube(`extended_order_facts`, {
cubes:
- name: order_facts
sql_table: orders

measures:
- name: count
type: count
Expand Down Expand Up @@ -386,6 +386,40 @@ cube(`extended_order_facts`, {
});
```

### <--{"id" : "Parameters"}--> public

<InfoBox>

In previous versions of Cube, this property was called `shown`.

</InfoBox>

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`.

<CodeTabs>

```javascript
cube(`orders`, {
sql_table: `public.orders`,
public: false,
});
```

```yaml
cubes:
- name: orders
sql_table: public.orders
public: false
```

</CodeTabs>

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
Expand Down Expand Up @@ -570,33 +604,6 @@ cubes:

</CodeTabs>

### <--{"id" : "Parameters"}--> shown

The `shown` property is used to manage the visibility of a cube. Valid values
for `shown` are `true` and `false`.

<CodeTabs>

```javascript
cube(`orders`, {
sql_table: `orders`,
shown: false,
});
```

```yaml
cubes:
- name: orders
sql_table: orders
shown: false
```

</CodeTabs>

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
Expand Down Expand Up @@ -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"
```

</CodeTabs>
Expand Down
17 changes: 12 additions & 5 deletions docs/content/Schema/Reference/dimensions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,17 @@ cubes:

</CodeTabs>

### <--{"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`.
<InfoBox>

In previous versions of Cube, this property was called `shown`.

</InfoBox>

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`.

<CodeTabs>

Expand All @@ -318,7 +325,7 @@ cube(`products`, {
comment: {
sql: `comments`,
type: `string`,
shown: false,
public: false,
},
},
});
Expand All @@ -332,7 +339,7 @@ cubes:
dimensions:
- name: comment
sql: comments
type: string
public: false
shown: false
```

Expand Down
17 changes: 12 additions & 5 deletions docs/content/Schema/Reference/measures.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -345,10 +345,17 @@ cubes:

</CodeTabs>

### <--{"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`.
<InfoBox>

In previous versions of Cube, this property was called `shown`.

</InfoBox>

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`.

<CodeTabs>

Expand All @@ -360,7 +367,7 @@ cube(`orders`, {
orders_count: {
sql: `id`,
type: `count`,
shown: false,
public: false,
},
},
});
Expand All @@ -375,7 +382,7 @@ cubes:
- name: orders_count
sql: id
type: count
shown: false
public: false
```

</CodeTabs>
Expand Down
30 changes: 30 additions & 0 deletions docs/content/Schema/Reference/segments.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,36 @@ cubes:

</CodeTabs>

### <--{"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`.

<CodeTabs>

```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
```

</CodeTabs>

### <--{"id" : "Parameters"}--> sql

The `sql` parameter defines how a segment would filter out a subset of data. It
Expand Down
19 changes: 13 additions & 6 deletions docs/content/Schema/Reference/view.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -198,17 +198,24 @@ views:

</CodeTabs>

### <--{"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`.
<InfoBox>

In previous versions of Cube, this property was called `shown`.

</InfoBox>

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`.

<CodeTabs>

```javascript
view(`arr`, {
description: `Annual Recurring Revenue`,
shown: true,
public: COMPILE_CONTEXT.security_context.is_finance,

includes: [
revenue.arr,
Expand All @@ -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
Expand All @@ -234,7 +241,7 @@ views:

</CodeTabs>

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].

Expand Down