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
Empty file modified .fossa.yml
100755 → 100644
Empty file.
Empty file modified .openapi-generator/FILES
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion .openapi-generator/VERSION
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.1.0-SNAPSHOT
6.3.0
Empty file modified .snyk
100755 → 100644
Empty file.
Empty file modified CHANGELOG.md
100755 → 100644
Empty file.
Empty file modified CONTRIBUTING.md
100755 → 100644
Empty file.
Empty file modified LICENSE
100755 → 100644
Empty file.
597 changes: 545 additions & 52 deletions NOTICE.txt
100755 → 100644

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![pypi](https://img.shields.io/pypi/v/openfga_sdk.svg?style=flat)](https://pypi.org/project/openfga_sdk)
[![Release](https://img.shields.io/github/v/release/openfga/python-sdk?sort=semver&color=green)](https://github.com/openfga/python-sdk/releases)
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](./LICENSE)
[![FOSSA Status](https://app.fossa.com/api/projects/custom%2B4989%2Fgithub.com%2Fopenfga%2Fpython-sdk.svg?type=shield)](https://app.fossa.com/reports/824fbc44-7513-4496-84a4-f7ffb3fa23f7)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fopenfga%2Fpython-sdk.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fopenfga%2Fpython-sdk?ref=badge_shield)
[![Discord Server](https://img.shields.io/discord/759188666072825867?color=7289da&logo=discord "Discord Server")](https://discord.com/channels/759188666072825867/930524706854031421)
[![Twitter](https://img.shields.io/twitter/follow/openfga?color=%23179CF0&logo=twitter&style=flat-square "@openfga on Twitter")](https://twitter.com/openfga)

Expand Down
Empty file modified VERSION.txt
100755 → 100644
Empty file.
Empty file modified docs/Any.md
100755 → 100644
Empty file.
Empty file modified docs/Assertion.md
100755 → 100644
Empty file.
Empty file modified docs/AuthorizationModel.md
100755 → 100644
Empty file.
Empty file modified docs/CheckRequest.md
100755 → 100644
Empty file.
Empty file modified docs/CheckResponse.md
100755 → 100644
Empty file.
Empty file modified docs/Computed.md
100755 → 100644
Empty file.
Empty file modified docs/ContextualTupleKeys.md
100755 → 100644
Empty file.
Empty file modified docs/CreateStoreRequest.md
100755 → 100644
Empty file.
Empty file modified docs/CreateStoreResponse.md
100755 → 100644
Empty file.
Empty file modified docs/Difference.md
100755 → 100644
Empty file.
Empty file modified docs/ErrorCode.md
100755 → 100644
Empty file.
Empty file modified docs/ExpandRequest.md
100755 → 100644
Empty file.
Empty file modified docs/ExpandResponse.md
100755 → 100644
Empty file.
Empty file modified docs/GetStoreResponse.md
100755 → 100644
Empty file.
Empty file modified docs/InternalErrorCode.md
100755 → 100644
Empty file.
Empty file modified docs/InternalErrorMessageResponse.md
100755 → 100644
Empty file.
Empty file modified docs/Leaf.md
100755 → 100644
Empty file.
Empty file modified docs/ListObjectsRequest.md
100755 → 100644
Empty file.
Empty file modified docs/ListObjectsResponse.md
100755 → 100644
Empty file.
Empty file modified docs/ListStoresResponse.md
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion docs/Metadata.md
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**relations** | [**dict(str, RelationMetadata)**](RelationMetadata.md) | | [optional]
**relations** | [**dict[str, RelationMetadata]**](RelationMetadata.md) | | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Expand Down
Empty file modified docs/Node.md
100755 → 100644
Empty file.
Empty file modified docs/Nodes.md
100755 → 100644
Empty file.
Empty file modified docs/NotFoundErrorCode.md
100755 → 100644
Empty file.
Empty file modified docs/ObjectRelation.md
100755 → 100644
Empty file.
8 changes: 4 additions & 4 deletions docs/OpenFgaApi.md
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Method | HTTP request | Description

Check whether a user is authorized to access an object

The Check API queries to check if the user has a certain relationship with an object in a certain store. A `contextual_tuples` object may also be included in the body of the request. This object contains one field `tuple_keys`, which is an array of tuple keys. You may also provide an `authorization_model_id` in the body. This will be used to assert that the input `tuple_key` is valid for the model specified. If not specified, the assertion will be made against the latest authorization model ID. The response will return whether the relationship exists in the field `allowed`. ## Example In order to check if user `user:anne` of type `user` has a `reader` relationship with object `document:2021-budget` given the following contextual tuple ```json { \"user\": \"user:anne\", \"relation\": \"member\", \"object\": \"time_slot:office_hours\" } ``` the Check API can be used with the following request body: ```json { \"tuple_key\": { \"user\": \"user:anne\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"contextual_tuples\": { \"tuple_keys\": [ { \"user\": \"user:anne\", \"relation\": \"member\", \"object\": \"time_slot:office_hours\" } ] } } ``` OpenFGA's response will include `{ \"allowed\": true }` if there is a relationship and `{ \"allowed\": false }` if there isn't.
The Check API queries to check if the user has a certain relationship with an object in a certain store. A `contextual_tuples` object may also be included in the body of the request. This object contains one field `tuple_keys`, which is an array of tuple keys. You may also provide an `authorization_model_id` in the body. This will be used to assert that the input `tuple_key` is valid for the model specified. If not specified, the assertion will be made against the latest authorization model ID. It is strongly recommended to specify authorization model id for better performance. The response will return whether the relationship exists in the field `allowed`. ## Example In order to check if user `user:anne` of type `user` has a `reader` relationship with object `document:2021-budget` given the following contextual tuple ```json { \"user\": \"user:anne\", \"relation\": \"member\", \"object\": \"time_slot:office_hours\" } ``` the Check API can be used with the following request body: ```json { \"tuple_key\": { \"user\": \"user:anne\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"contextual_tuples\": { \"tuple_keys\": [ { \"user\": \"user:anne\", \"relation\": \"member\", \"object\": \"time_slot:office_hours\" } ] }, \"authorization_model_id\": \"01G50QVV17PECNVAHX1GG4Y5NC\" } ``` OpenFGA's response will include `{ \"allowed\": true }` if there is a relationship and `{ \"allowed\": false }` if there isn't.

### Example

Expand Down Expand Up @@ -261,7 +261,7 @@ No authorization required

Expand all relationships in userset tree format, and following userset rewrite rules. Useful to reason about and debug a certain relationship

The Expand API will return all users and usersets that have certain relationship with an object in a certain store. This is different from the `/stores/{store_id}/read` API in that both users and computed usersets are returned. Body parameters `tuple_key.object` and `tuple_key.relation` are all required. The response will return a tree whose leaves are the specific users and usersets. Union, intersection and difference operator are located in the intermediate nodes. ## Example To expand all users that have the `reader` relationship with object `document:2021-budget`, use the Expand API with the following request body ```json { \"tuple_key\": { \"object\": \"document:2021-budget\", \"relation\": \"reader\" } } ``` OpenFGA's response will be a userset tree of the users and usersets that have read access to the document. ```json { \"tree\":{ \"root\":{ \"type\":\"document:2021-budget#reader\", \"union\":{ \"nodes\":[ { \"type\":\"document:2021-budget#reader\", \"leaf\":{ \"users\":{ \"users\":[ \"user:bob\" ] } } }, { \"type\":\"document:2021-budget#reader\", \"leaf\":{ \"computed\":{ \"userset\":\"document:2021-budget#writer\" } } } ] } } } } ``` The caller can then call expand API for the `writer` relationship for the `document:2021-budget`.
The Expand API will return all users and usersets that have certain relationship with an object in a certain store. This is different from the `/stores/{store_id}/read` API in that both users and computed usersets are returned. Body parameters `tuple_key.object` and `tuple_key.relation` are all required. The response will return a tree whose leaves are the specific users and usersets. Union, intersection and difference operator are located in the intermediate nodes. ## Example To expand all users that have the `reader` relationship with object `document:2021-budget`, use the Expand API with the following request body ```json { \"tuple_key\": { \"object\": \"document:2021-budget\", \"relation\": \"reader\" }, \"authorization_model_id\": \"01G50QVV17PECNVAHX1GG4Y5NC\" } ``` OpenFGA's response will be a userset tree of the users and usersets that have read access to the document. ```json { \"tree\":{ \"root\":{ \"type\":\"document:2021-budget#reader\", \"union\":{ \"nodes\":[ { \"type\":\"document:2021-budget#reader\", \"leaf\":{ \"users\":{ \"users\":[ \"user:bob\" ] } } }, { \"type\":\"document:2021-budget#reader\", \"leaf\":{ \"computed\":{ \"userset\":\"document:2021-budget#writer\" } } } ] } } } } ``` The caller can then call expand API for the `writer` relationship for the `document:2021-budget`.

### Example

Expand Down Expand Up @@ -419,7 +419,7 @@ No authorization required

[EXPERIMENTAL] Get all objects of the given type that the user has a relation with

The ListObjects API returns a list of all the objects of the given type that the user has a relation with. To achieve this, both the store tuples and the authorization model are used. An `authorization_model_id` may be specified in the body. If it is, it will be used to decide the underlying implementation used. If it is not specified, the latest authorization model ID will be used. You may also specify `contextual_tuples` that will be treated as regular tuples. The response will contain the related objects in an array in the \"objects\" field of the response and they will be strings in the object format `<type>:<id>` (e.g. \"document:roadmap\")
The ListObjects API returns a list of all the objects of the given type that the user has a relation with. To achieve this, both the store tuples and the authorization model are used. An `authorization_model_id` may be specified in the body. If it is, it will be used to decide the underlying implementation used. If it is not specified, the latest authorization model ID will be used. It is strongly recommended to specify authorization model id for better performance. You may also specify `contextual_tuples` that will be treated as regular tuples. The response will contain the related objects in an array in the \"objects\" field of the response and they will be strings in the object format `<type>:<id>` (e.g. \"document:roadmap\")

### Example

Expand Down Expand Up @@ -984,7 +984,7 @@ No authorization required

Add or delete tuples from the store

The Write API will update the tuples for a certain store. Tuples and type definitions allow OpenFGA to determine whether a relationship exists between an object and an user. In the body, `writes` adds new tuples while `deletes` removes existing tuples. The API is not idempotent: if, later on, you try to add the same tuple, or if you try to delete a non-existing tuple, it will throw an error. An `authorization_model_id` may be specified in the body. If it is, it will be used to assert that each written tuple (not deleted) is valid for the model specified. If it is not specified, the latest authorization model ID will be used. ## Example ### Adding relationships To add `user:anne` as a `writer` for `document:2021-budget`, call write API with the following ```json { \"writes\": { \"tuple_keys\": [ { \"user\": \"user:anne\", \"relation\": \"writer\", \"object\": \"document:2021-budget\" } ] } } ``` ### Removing relationships To remove `user:bob` as a `reader` for `document:2021-budget`, call write API with the following ```json { \"deletes\": { \"tuple_keys\": [ { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" } ] } } ```
The Write API will update the tuples for a certain store. Tuples and type definitions allow OpenFGA to determine whether a relationship exists between an object and an user. In the body, `writes` adds new tuples while `deletes` removes existing tuples. The API is not idempotent: if, later on, you try to add the same tuple, or if you try to delete a non-existing tuple, it will throw an error. An `authorization_model_id` may be specified in the body. If it is, it will be used to assert that each written tuple (not deleted) is valid for the model specified. If it is not specified, the latest authorization model ID will be used. ## Example ### Adding relationships To add `user:anne` as a `writer` for `document:2021-budget`, call write API with the following ```json { \"writes\": { \"tuple_keys\": [ { \"user\": \"user:anne\", \"relation\": \"writer\", \"object\": \"document:2021-budget\" } ] }, \"authorization_model_id\": \"01G50QVV17PECNVAHX1GG4Y5NC\" } ``` ### Removing relationships To remove `user:bob` as a `reader` for `document:2021-budget`, call write API with the following ```json { \"deletes\": { \"tuple_keys\": [ { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" } ] } } ```

### Example

Expand Down
Empty file modified docs/PathUnknownErrorMessageResponse.md
100755 → 100644
Empty file.
Empty file modified docs/ReadAssertionsResponse.md
100755 → 100644
Empty file.
Empty file modified docs/ReadAuthorizationModelResponse.md
100755 → 100644
Empty file.
Empty file modified docs/ReadAuthorizationModelsResponse.md
100755 → 100644
Empty file.
Empty file modified docs/ReadChangesResponse.md
100755 → 100644
Empty file.
Empty file modified docs/ReadRequest.md
100755 → 100644
Empty file.
Empty file modified docs/ReadResponse.md
100755 → 100644
Empty file.
Empty file modified docs/RelationMetadata.md
100755 → 100644
Empty file.
Empty file modified docs/RelationReference.md
100755 → 100644
Empty file.
Empty file modified docs/Status.md
100755 → 100644
Empty file.
Empty file modified docs/Store.md
100755 → 100644
Empty file.
Empty file modified docs/Tuple.md
100755 → 100644
Empty file.
Empty file modified docs/TupleChange.md
100755 → 100644
Empty file.
Empty file modified docs/TupleKey.md
100755 → 100644
Empty file.
Empty file modified docs/TupleKeys.md
100755 → 100644
Empty file.
Empty file modified docs/TupleOperation.md
100755 → 100644
Empty file.
Empty file modified docs/TupleToUserset.md
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion docs/TypeDefinition.md
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**type** | **str** | |
**relations** | [**dict(str, Userset)**](Userset.md) | | [optional]
**relations** | [**dict[str, Userset]**](Userset.md) | | [optional]
**metadata** | [**Metadata**](Metadata.md) | | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
Expand Down
Empty file modified docs/Users.md
100755 → 100644
Empty file.
Empty file modified docs/Userset.md
100755 → 100644
Empty file.
Empty file modified docs/UsersetTree.md
100755 → 100644
Empty file.
Empty file modified docs/UsersetTreeDifference.md
100755 → 100644
Empty file.
Empty file modified docs/UsersetTreeTupleToUserset.md
100755 → 100644
Empty file.
Empty file modified docs/Usersets.md
100755 → 100644
Empty file.
Empty file modified docs/ValidationErrorMessageResponse.md
100755 → 100644
Empty file.
Empty file modified docs/WriteAssertionsRequest.md
100755 → 100644
Empty file.
Empty file modified docs/WriteAuthorizationModelRequest.md
100755 → 100644
Empty file.
Empty file modified docs/WriteAuthorizationModelResponse.md
100755 → 100644
Empty file.
Empty file modified docs/WriteRequest.md
100755 → 100644
Empty file.
Empty file modified openfga_sdk/__init__.py
100755 → 100644
Empty file.
Empty file modified openfga_sdk/api/__init__.py
100755 → 100644
Empty file.
Loading