Skip to content

Commit

Permalink
docs(cli): correct contextual tuples examples
Browse files Browse the repository at this point in the history
  • Loading branch information
ewanharris committed Jan 9, 2024
1 parent 5a9cb58 commit 57cf0fd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ On the "transaction" type:

Now that we have updated our authorization model to take time and ip address into consideration, you will notice that Anne has lost access because nothing indicates that Anne is connecting from an approved ip address and time. You can verify that by issuing the following check:

<CheckRequestViewer user={'anne'} relation={'can_view'} object={'transaction:A'} allowed={false} />
<CheckRequestViewer user={'user:anne'} relation={'can_view'} object={'transaction:A'} allowed={false} />

We need to add relationship tuples to mark some approved timeslots and ip address ranges:

Expand Down
4 changes: 2 additions & 2 deletions src/components/Docs/SnippetViewer/CheckRequestViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ ${
case SupportedLanguage.CLI:
return `fga query check --store-id=$FGA_STORE_ID --model-id=${modelId} ${user} ${relation} ${object}${
contextualTuples
? ` --contextual_tuples ${contextualTuples
.map((tuple) => `"${tuple.user} ${tuple.relation} ${tuple.object}"`)
? `${contextualTuples
.map((tuple) => ` --contextual-tuple "${tuple.user} ${tuple.relation} ${tuple.object}"`)
.join(' ')}`
: ''}${
context ? ` --context='${JSON.stringify(context)}'`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ function listObjectsRequestViewer(lang: SupportedLanguage, opts: ListObjectsRequ
case SupportedLanguage.CLI:
return `fga query list-objects --store-id=\${FGA_STORE_ID} --model-id=${modelId} ${user} ${relation} ${objectType}${
contextualTuples
? ` --contextual_tuples ${contextualTuples
.map((tuple) => `"${tuple.user} ${tuple.relation} ${tuple.object}"`)
? `${contextualTuples
.map((tuple) => ` --contextual-tuple "${tuple.user} ${tuple.relation} ${tuple.object}"`)
.join(' ')}`
: ''
}${
Expand Down

0 comments on commit 57cf0fd

Please sign in to comment.