Skip to content

Commit

Permalink
Merge branch 'main' into remove_experiment_cache
Browse files Browse the repository at this point in the history
  • Loading branch information
adriantam authored Dec 1, 2023
2 parents ee027db + d3d28d4 commit 5a23f6f
Show file tree
Hide file tree
Showing 11 changed files with 473 additions and 368 deletions.
30 changes: 10 additions & 20 deletions docs/content/modeling/advanced/entitlements.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,6 @@ Add it now. Like so:

<AuthzModelSnippetViewer
configuration={{
schema_version: '1.1',
type: 'feature',
relations: {
associated_plan: {
Expand Down Expand Up @@ -433,24 +432,19 @@ If you have already completed some of the other tutorials you might have encount

<AuthzModelSnippetViewer
configuration={{
schema_version: '1.1',
type_definitions: [
{
type: 'object',
relations: {
viewer: {
tupleToUserset: {
tupleset: {
relation: 'parent',
},
computedUserset: {
relation: 'all_objects_viewer',
},
},
type: 'resource',
relations: {
viewer: {
tupleToUserset: {
tupleset: {
relation: 'parent',
},
computedUserset: {
relation: 'all_objects_viewer',
},
},
},
],
},
}}
skipVersion={true}
/>
Expand All @@ -469,7 +463,6 @@ If you want to give all subscribers on a plan access to a feature, you can do it

<AuthzModelSnippetViewer
configuration={{
schema_version: '1.1',
type: 'feature',
relations: {
associated_plan: {
Expand Down Expand Up @@ -728,7 +721,6 @@ To disallow a direct relationship, you need to remove the direct relationship ty

<AuthzModelSnippetViewer
configuration={{
schema_version: '1.1',
type: 'feature',
relations: {
associated_plan: {
Expand Down Expand Up @@ -770,7 +762,6 @@ becomes

<AuthzModelSnippetViewer
configuration={{
schema_version: '1.1',
type: 'feature',
relations: {
associated_plan: {
Expand Down Expand Up @@ -812,7 +803,6 @@ Ensure that your authorization model matches the one below

<AuthzModelSnippetViewer
configuration={{
schema_version: '1.1',
type_definitions: [
{
type: 'user',
Expand Down
73 changes: 34 additions & 39 deletions docs/content/modeling/advanced/gdrive.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -582,48 +582,43 @@ We express it like this:

<AuthzModelSnippetViewer
configuration={{
schema_version: '1.1',
type_definitions: [
{
type: 'document',
relations: {
viewer: {
union: {
child: [
{
this: {},
},
{
computedUserset: {
relation: 'commenter',
},
},
{
tupleToUserset: {
tupleset: {
// read all relationship tuples related to document:2021-budget as parent
// which returns [{ "object": "document:2021-budget", "relation": "parent", "user": "document:2021-planning"}]
relation: 'parent',
},
computedUserset: {
// and for each relationship tuple return all usersets that match the following, replacing $TUPLE_USERSET_OBJECT with document:2021-planning
// this will return relationship tuples of shape { "object": "document:2021-planning", "viewer", "user": ??? }
// including { "object": "document:2021-planning", "viewer", "user": "user:diane" }
relation: 'viewer',
},
},
},
],
type: 'document',
relations: {
viewer: {
union: {
child: [
{
this: {},
},
},
},
metadata: {
relations: {
viewer: { directly_related_user_types: [{ type: 'user' }, { type: 'domain', relation: 'member' }] },
},
{
computedUserset: {
relation: 'commenter',
},
},
{
tupleToUserset: {
tupleset: {
// read all relationship tuples related to document:2021-budget as parent
// which returns [{ "object": "document:2021-budget", "relation": "parent", "user": "document:2021-planning"}]
relation: 'parent',
},
computedUserset: {
// and for each relationship tuple return all usersets that match the following, replacing $TUPLE_USERSET_OBJECT with document:2021-planning
// this will return relationship tuples of shape { "object": "document:2021-planning", "viewer", "user": ??? }
// including { "object": "document:2021-planning", "viewer", "user": "user:diane" }
relation: 'viewer',
},
},
},
],
},
},
],
},
metadata: {
relations: {
viewer: { directly_related_user_types: [{ type: 'user' }, { type: 'domain', relation: 'member' }] },
},
},
}}
skipVersion={true}
/>
Expand Down
34 changes: 13 additions & 21 deletions docs/content/modeling/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -795,9 +795,7 @@ When a document is created a relationship tuple will be stored in <ProductName f

<AuthzModelSnippetViewer
onlyShow={SyntaxFormat.Friendly2}
configuration={{
schema_version: '1.1',
type_definitions: [
configuration={
{
type: 'document',
relations: {
Expand All @@ -808,8 +806,6 @@ When a document is created a relationship tuple will be stored in <ProductName f
parent: { directly_related_user_types: [{ type: 'folder' }, { type: 'drive' }] },
},
},
},
],
}}
skipVersion={true}
/>
Expand Down Expand Up @@ -839,10 +835,10 @@ We can achieve that with the following definition using <UpdateProductNameInLink
<AuthzModelSnippetViewer
onlyShow={SyntaxFormat.Friendly2}
skipVersion={true}
configuration={{
schema_version: '1.1',
type_definitions: [
{
configuration={
{
type: 'document',
relations: {
can_share: {
union: {
child: [
Expand Down Expand Up @@ -873,8 +869,7 @@ We can achieve that with the following definition using <UpdateProductNameInLink
],
},
},
},
],
}
}}
/>

Expand All @@ -900,8 +895,8 @@ Similar to the [can_share relation](#relation-can_share), we can achieve that wi
onlyShow={SyntaxFormat.Friendly2}
skipVersion={true}
configuration={{
schema_version: '1.1',
type_definitions: [
type: 'document',
relations:
{
can_view: {
union: {
Expand Down Expand Up @@ -952,7 +947,6 @@ Similar to the [can_share relation](#relation-can_share), we can achieve that wi
},
},
},
],
}}
/>

Expand All @@ -968,8 +962,8 @@ Similar to the [can_share relation](#relation-can_share), we can achieve that wi
onlyShow={SyntaxFormat.Friendly2}
skipVersion={true}
configuration={{
schema_version: '1.1',
type_definitions: [
type: 'document',
relations:
{
can_write: {
union: {
Expand Down Expand Up @@ -1002,7 +996,6 @@ Similar to the [can_share relation](#relation-can_share), we can achieve that wi
},
},
},
],
}}
/>

Expand All @@ -1018,8 +1011,8 @@ Similar to the [can_share relation](#relation-can_share), we can achieve that wi
onlyShow={SyntaxFormat.Friendly2}
skipVersion={true}
configuration={{
schema_version: '1.1',
type_definitions: [
type: 'document',
relations:
{
can_change_owner: {
computedUserset: {
Expand All @@ -1028,7 +1021,6 @@ Similar to the [can_share relation](#relation-can_share), we can achieve that wi
},
},
},
],
}}
/>

Expand Down Expand Up @@ -1453,7 +1445,7 @@ Because anne is the owner of document:1:

Because beth is a member of organization:fabrikam and members of organization:fabrikam are writer of document:1:

- user **beth** does not have relation **can_share** with document:1
- user **beth** has relation **can_share** with document:1
- user **beth** has relation **can_write** with document:1
- user **beth** has relation **can_view** with document:1
- user **beth** does not have relation **can_change_owner** with document:1
Expand Down
2 changes: 1 addition & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ using OpenFga.Sdk.Model;`,
python: {
importStatement: `import os
import json
import openfga_sdk
from openfga_sdk.client import ClientConfiguration
from openfga_sdk.client import OpenFgaClient`,
apiName: `OpenFgaClient`,
setupNote: `# ApiTokenIssuer, ApiAudience, ClientId and ClientSecret are optional.\n`,
Expand Down
Loading

0 comments on commit 5a23f6f

Please sign in to comment.