limited-city-59768
02/16/2024, 12:58 PMchilly-king-10285
02/16/2024, 12:58 PMchilly-king-10285
02/16/2024, 12:58 PMjson { "namespace": "string", "object": "string", "relation": "string", "subject_id": "string", "subject_set": { "namespace": "string", "object": "string", "relation": "string" } }
In your request body, you have an additional subject_set
nested inside the first subject_set
, which is not mentioned in the provided extracts. Also, the subject_id
field is missing in your request body. According to the extracts, either subject_set
or subject_id
can be provided. So, your request body should look something like this: json { "namespace": "Document", "object": "test.txt", "relation": "owners", "subject_id": "string", "subject_set": { "namespace": "Roles", "object": "Front-desk", "relation": "child" } }
Please replace "string"
with the actual value you want to use. Source: [Ory API Reference](https://www.ory.sh/docs/reference/api)limited-city-59768
02/16/2024, 1:07 PMchilly-king-10285
02/16/2024, 1:07 PMchilly-king-10285
02/16/2024, 1:08 PMchilly-king-10285
02/16/2024, 1:08 PMsubject_id
but allows you to define a set of subjects that have the defined relationship with the object. In your example, the subject set is defined within the "Roles" namespace with the object "Front-desk" and the relation "child". This could mean that all subjects that are children of the "Front-desk" role are owners of the document "test.txt". Please note that according to the provided extracts, either subject_set
or subject_id
can be provided, not both. Source: [Ory API Reference](https://www.ory.sh/docs/reference/api)chilly-king-10285
02/16/2024, 1:08 PMjson { "namespace": "Document", "object": "test.txt", "relation": "owners", "subject_id": "string", "subject_set": { "namespace": "Roles", "object": "Front-desk", "relation": "child" } }
Here's what each field represents: - `namespace`: This is the namespace to query. In this case, it's "Document". - `object`: This is the object to query. In this case, it's "test.txt". - `relation`: This is the relation to query. In this case, it's "owners". - `subject_id`: This is the SubjectID to query. Either SubjectSet or SubjectID can be provided. In this case, it's a placeholder string. - `subject_set`: This is an object that represents the Subject Set. It has the following properties: - `namespace`: This is the namespace of the Subject Set. In this case, it's "Roles". - `object`: This is the object of the Subject Set. In this case, it's "Front-desk". - `relation`: This is the relation of the Subject Set. In this case, it's "child". This request body is used to create a relationship in the Ory system. The relationship is defined by the namespace
, object
, and relation
fields, and it involves the subject defined by either the subject_id
or the subject_set
. Source: [Ory API Reference](https://www.ory.sh/docs/reference/api)limited-city-59768
02/16/2024, 1:11 PMchilly-king-10285
02/16/2024, 1:11 PMchilly-king-10285
02/16/2024, 1:11 PMrelation
field within the subject_set
is used to specify the type of relationship that the subjects in the set have with the object. In the context of Ory, a subject_set
is a set of all subjects that have a specific relation on an object. They empower Ory Permissions to be as flexible as needed by defining indirections. They can be used to realize, for example, Role-Based Access Control (RBAC) or inheritance of relations. Subject sets themselves can again indirect to subject sets. So, the relation
in subject_set
is crucial to define the specific type of connection or access that the group of subjects (defined in the subject_set
) has with the object. For example, in the request body you provided: json {{ "namespace": "Document", "object": "test.txt", "relation": "owners", "subject_set": {{ "namespace": "Roles", "object": "Front-desk", "relation": "child" }} }}
The relation
"child" within the subject_set
could mean that all subjects that are children of the "Front-desk" role in the "Roles" namespace are owners of the document "test.txt" in the "Document" namespace. Sources: - [Ory API Reference](https://www.ory.sh/docs/reference/api) - [Ory Keto Concepts - Subjects](https://www.ory.sh/docs/keto/concepts/subjects)