Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: openfga/openfga.dev
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 07c53a6774ff6772feff6563dc12d49be3054c65
Choose a base ref
..
head repository: openfga/openfga.dev
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: ef5e5abcb3e66f41e2fb55a87a96f9969304faeb
Choose a head ref
Showing with 817 additions and 735 deletions.
  1. +17 −27 docs/content/getting-started/create-store.mdx
  2. +2 −3 docs/content/getting-started/framework.mdx
  3. +83 −73 docs/content/getting-started/setup-sdk-client.mdx
  4. +2 −2 docs/content/interacting/managing-group-access.mdx
  5. +2 −2 docs/content/interacting/managing-group-membership.mdx
  6. +2 −2 docs/content/interacting/managing-relationships-between-objects.mdx
  7. +2 −2 docs/content/interacting/managing-user-access.mdx
  8. +2 −2 docs/content/interacting/transactional-writes.mdx
  9. +2 −2 docs/content/modeling/blocklists.mdx
  10. +2 −2 docs/content/modeling/building-blocks/concentric-relationships.mdx
  11. +2 −2 docs/content/modeling/building-blocks/direct-relationships.mdx
  12. +2 −2 docs/content/modeling/building-blocks/object-to-object-relationships.mdx
  13. +17 −0 docs/content/modeling/conditions.mdx
  14. +4 −3 docs/content/modeling/contextual-time-based-authorization.mdx
  15. +2 −2 docs/content/modeling/custom-roles.mdx
  16. +2 −2 docs/content/modeling/direct-access.mdx
  17. +18 −51 docs/content/modeling/getting-started.mdx
  18. +2 −2 docs/content/modeling/multiple-restrictions.mdx
  19. +2 −2 docs/content/modeling/organization-context-authorization.mdx
  20. +2 −2 docs/content/modeling/parent-child.mdx
  21. +2 −2 docs/content/modeling/public-access.mdx
  22. +2 −2 docs/content/modeling/roles-and-permissions.mdx
  23. +2 −2 docs/content/modeling/user-groups.mdx
  24. +5 −4 docusaurus.config.js
  25. +480 −460 package-lock.json
  26. +10 −10 package.json
  27. +1 −2 src/components/Docs/CardBox/CardBox.module.css
  28. +22 −4 src/components/Docs/SnippetViewer/CheckRequestViewer.tsx
  29. +5 −2 src/components/Docs/SnippetViewer/ExpandRequestViewer.tsx
  30. +27 −10 src/components/Docs/SnippetViewer/ListObjectsRequestViewer.tsx
  31. +9 −4 src/components/Docs/SnippetViewer/ReadChangesRequestViewer.tsx
  32. +7 −4 src/components/Docs/SnippetViewer/ReadRequestViewer.tsx
  33. +17 −14 src/components/Docs/SnippetViewer/SdkSetup.tsx
  34. +6 −12 src/components/Docs/SnippetViewer/WriteAuthzModelViewer.tsx
  35. +53 −18 src/components/Docs/SnippetViewer/WriteRequestViewer.tsx
44 changes: 17 additions & 27 deletions docs/content/getting-started/create-store.mdx
Original file line number Diff line number Diff line change
@@ -43,17 +43,18 @@ const { id: storeId } = await openFga.createStore({

```go
import (
openfga "github.com/openfga/go-sdk"
. "github.com/openfga/go-sdk/client"
"context"
"os"

. "github.com/openfga/go-sdk/client"
)

func main() {
fgaClient, err := NewSdkClient(&ClientConfiguration{
ApiScheme: os.Getenv("FGA_API_SCHEME"), // optional. Can be "http" or "https". Defaults to "https"
ApiHost: os.Getenv("FGA_API_HOST"), // required, define without the scheme (e.g. api.fga.example instead of https://api.fga.example)
StoreId: os.Getenv("FGA_STORE_ID"), // optional, not needed for \`CreateStore\` and \`ListStores\`, required before calling for all other methods
AuthorizationModelId: openfga.PtrString(os.Getenv("FGA_MODEL_ID")), // optional, can be overridden per request
AuthorizationModelId: os.Getenv("FGA_MODEL_ID"), // optional, can be overridden per request
})

if err != nil {
@@ -81,18 +82,14 @@ namespace ExampleApp;
class MyProgram {
static async Task Main() {
var configuration = new ClientConfiguration() {
ApiScheme = Environment.GetEnvironmentVariable("FGA_API_SCHEME"), // optional. Can be "http" or "https". Defaults to "https"
ApiHost = Environment.GetEnvironmentVariable("FGA_API_HOST"), // required, define without the scheme (e.g. api.fga.example instead of https://api.fga.example)
var configuration = new ClientConfiguration() {
ApiUrl = Environment.GetEnvironmentVariable("FGA_API_URL") ?? "http://localhost:8080", // required, e.g. https://api.fga.example
StoreId = Environment.GetEnvironmentVariable("FGA_STORE_ID"), // optional, not needed for \`CreateStore\` and \`ListStores\`, required before calling for all other methods
AuthorizationModelId = Environment.GetEnvironmentVariable("FGA_MODEL_ID"), // optional, can be overridden per request
};
var fgaClient = new OpenFgaClient(configuration);
var store = await fgaClient.CreateStore(new ClientCreateStoreRequest(){Name = "FGA Demo"})
{
Name = "FGA Demo Store"
});
var store = await fgaClient.CreateStore(new ClientCreateStoreRequest(){Name = "FGA Demo Store"});
}
}
```
@@ -102,32 +99,25 @@ class MyProgram {
<TabItem value={SupportedLanguage.PYTHON_SDK} label={languageLabelMap.get(SupportedLanguage.PYTHON_SDK)}>

```python
import asyncio
import os
import openfga_sdk
from openfga_sdk.client import OpenFgaClient
from openfga_sdk.models.create_store_request import CreateStoreRequest

configuration = openfga_sdk.Configuration(
scheme = os.environ.get('FGA_API_SCHEME'),
api_host = os.environ.get('FGA_API_HOST'),
)

async with OpenFgaClient(configuration) as fga_client:
body = CreateStoreRequest(
name = "FGA Demo Store",
)
response = await fga_client.create_store(body)
async def main():
configuration = openfga_sdk.Configuration(
api_scheme = os.environ.get('FGA_API_SCHEME'),
api_host = os.environ.get('FGA_API_HOST'),
)

async def create_store():
try:
# Create a store
async with OpenFgaClient(configuration) as fga_client:
body = CreateStoreRequest(
name = "FGA Demo",
name = "FGA Demo Store",
)
api_response = await fga_client_instance.create_store(body)
except openfga_sdk.ApiException as e:
print("Exception when calling OpenFgaClient->create_store: %s\n" % e)
response = await fga_client.create_store(body)

asyncio.run(main())
```

</TabItem>
5 changes: 2 additions & 3 deletions docs/content/getting-started/framework.mdx
Original file line number Diff line number Diff line change
@@ -409,7 +409,6 @@ import (

jwtware "github.com/gofiber/jwt/v3"
"github.com/golang-jwt/jwt/v4"
openfga "github.com/openfga/go-sdk"
. "github.com/openfga/go-sdk/client"
)

@@ -483,7 +482,7 @@ func checkAuthorization(c *fiber.Ctx) error {
ApiScheme: os.Getenv("FGA_API_SCHEME"), // optional. Can be "http" or "https". Defaults to "https"
ApiHost: os.Getenv("FGA_API_HOST"), // required, define without the scheme (e.g. api.fga.example instead of https://api.fga.example)
StoreId: os.Getenv("FGA_STORE_ID"), // optional, not needed for \`CreateStore\` and \`ListStores\`, required before calling for all other methods
AuthorizationModelId: openfga.PtrString(os.Getenv("FGA_MODEL_ID")), // optional, can be overridden per request
AuthorizationModelId: os.Getenv("FGA_MODEL_ID"), // optional, can be overridden per request
})

if err != nil {
@@ -495,7 +494,7 @@ func checkAuthorization(c *fiber.Ctx) error {
Relation: c.Locals("relation").(string),
Object: c.Locals("object").(string),
}
data, err := fgaClient.OpenFga.Check(context.Background()).Body(body).Execute()
data, err := fgaClient.Check(context.Background()).Body(body).Execute()

if err != nil {
return fiber.NewError(fiber.StatusServiceUnavailable, "Unable to check for authorization")
Loading