<@U04UQ68083H> How can I setup an initial relation...
# ory-copilot
c
@chilly-king-10285 How can I setup an initial relationship tuples in Ory Keto in a self hosted environment? I already have setup my permission system in a file
namespaces.keto.ts
where it has
Users
and
Groups
, How can I load initial users or groups to the system?
c
A message from kapa.ai
To set up initial relationship tuples in Ory Keto, you can use the Ory CLI. You can create relationships in your Ory Network project using the Ory CLI. The relationships showcase the namespace configuration. For example, you can define a
developer
group with two members and a folder hierarchy. Through the rules in the Ory Permission Language, every member of the
developer
group can access the files in the hierarchy. You can create additional fine-grained permission rules for certain objects, similar to the
private
file. Here is an example of how you can create these relationships: 1. Save your relationships in a file named
relationships.json
in your current working directory. The content of this file should follow the format of the relationships you want to create. Unfortunately, the exact format of this file is not provided in the extracts. 2. Run the following command to create these relationships in Ory Permissions:
Copy code
bash ory create relationships relationships.json
The output of this command will show the relationships that have been created. You can manage these relation tuples using the Ory CLI. To run these operations, you must provide the ID of the project in which you want to manage the tuples using the
--project
flag. For convenience, you can export the ID of your project as an environment variable and use the variable with the
--project
flag instead of passing the project ID directly in the command. Here is an example of how you can create a relation tuple:
Copy code
bash echo "groups:devs#member@tom" \    | ory parse relation-tuples --project=$PROJECT --format=json \    | ory create relation-tuples --project=$PROJECT
And to list all the relation tuples:
Copy code
bash ory list relation-tuples --project=$PROJECT
For more information, you can refer to the [Ory CLI reference](https://www.ory.sh/docs/cli/ory-create-relation-tuples) and the [Ory CLI reference for listing relation tuples](https://www.ory.sh/docs/cli/ory-list-relation-tuples). Sources: - [Creating relationships](https://www.ory.sh/docs/guides/permissions/overview#creating-relationships) - [Managing relation tuples](https://www.ory.sh/docs/guides/cli/configure-permission-service#manage-relation-tuples)