Skip to content

Latest commit

 

History

History
226 lines (175 loc) · 6.7 KB

update-tuples.mdx

File metadata and controls

226 lines (175 loc) · 6.7 KB
title sidebar_position slug description
Update Relationship Tuples
3
/getting-started/update-tuples
Updating system state by writing and deleting relationship tuples

import { DocumentationNotice, RelatedSection, SdkSetupHeader, SupportedLanguage, languageLabelMap, ProductConcept, ProductName, ProductNameFormat, WriteRequestViewer, SdkSetupPrerequisite, } from '@components/Docs'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';

Update Relationship Tuples

This section will illustrate how to update .

Before You Start

  1. You have installed the SDK.
  2. You have configured the authorization model.
  3. You have loaded FGA_STORE_ID and FGA_API_HOST as environment variables.
  1. You have installed the SDK.
  2. You have configured the authorization model.
  3. You have loaded FGA_STORE_ID and FGA_API_HOST as environment variables.
  1. You have installed the SDK.
  2. You have configured the authorization model.
  3. You have loaded FGA_STORE_ID and FGA_API_HOST as environment variables.
  1. You have installed the SDK.
  2. You have configured the authorization model.
  3. You have loaded FGA_STORE_ID and FGA_API_HOST as environment variables.
  1. You have installed the SDK.
  2. You have configured the authorization model.
  3. You have loaded FGA_STORE_ID and FGA_API_HOST as environment variables.
  1. You have configured the authorization model.
  2. You have loaded FGA_STORE_ID and FGA_SERVER_URL as environment variables.
  1. You have configured the authorization model.
  2. You have loaded FGA_STORE_ID and FGA_API_HOST as environment variables.

Step By Step

Assume that you want to add user user:anne to have relationship reader with object document:Z

{
  user: 'user:anne',
  relation: 'reader',
  object: 'document:Z',
}

01. Configure The API Client

Before calling the write API, you will need to configure the API client.

To obtain the access token:

02. Calling Write API To Add New Relationship Tuples

To add the relationship tuples, we can invoke the write API.

<WriteRequestViewer relationshipTuples={[ { user: 'user:anne', relation: 'reader', object: 'document:Z', }, ]} skipSetup={true} allowedLanguages={[ SupportedLanguage.JS_SDK, SupportedLanguage.GO_SDK, SupportedLanguage.DOTNET_SDK, SupportedLanguage.PYTHON_SDK, SupportedLanguage.JAVA_SDK, SupportedLanguage.CLI, SupportedLanguage.CURL, ]} />

03. Calling Write API To Delete Relationship Tuples

To delete relationship tuples, we can invoke the write API.

Assume that you want to delete user user:anne's reader relationship with object document:Z

{
  user: 'user:anne',
  relation: 'reader',
  object: 'document:Z',
}

<WriteRequestViewer deleteRelationshipTuples={[ { user: 'user:anne', relation: 'reader', object: 'document:Z', }, ]} skipSetup={true} allowedLanguages={[ SupportedLanguage.JS_SDK, SupportedLanguage.GO_SDK, SupportedLanguage.DOTNET_SDK, SupportedLanguage.PYTHON_SDK, SupportedLanguage.JAVA_SDK, SupportedLanguage.CLI, SupportedLanguage.CURL, ]} />

Related Sections

<RelatedSection description="Check the following sections for more on how to write your authorization data" relatedLinks={[ { title: 'Managing User Access', description: 'Learn about how to give a user access to a particular object.', link: '../interacting/managing-user-access', id: '../interacting/managing-user-access.mdx', }, { title: 'Managing Group Access', description: 'Learn about how to give a group of users access to a particular object.', link: '../interacting/managing-group-access', id: '../interacting/managing-group-access.mdx', }, { title: 'Transactional Writes', description: 'Learn about how to update multiple relations within the same API call.', link: '../interacting/transactional-writes', id: '../interacting/transactional-writes.mdx', }, ]} />