busy-journalist-23784
05/23/2024, 3:18 PMchilly-king-10285
05/23/2024, 3:18 PMchilly-king-10285
05/23/2024, 3:18 PMjson PUT <http://localhost:4467/admin/relation-tuples/> { "namespace": "data-reference-app", "object": "country", "relation": "read", "subject_id": "user_with_email_X", "subject_set": { "namespace": "data-reference-app", "object": "country", "relation": "read" } }
In this request, 'user_with_email_X' is the 'subject_id' and the 'superuser' is represented as the 'subject_set'. This means that 'user_with_email_X' will have the same permissions as the 'superuser'. Please replace 'user_with_email_X' with the actual email of the user. This is based on the information provided in the [Ory Keto API documentation](https://www.ory.sh/docs/keto/reference/rest-api) for creating a relationship.busy-journalist-23784
05/23/2024, 3:22 PM"subject_set": {
"namespace": "data-reference-app",
"object": "country",
"relation": "read"
}
We are connecting user_with_email_X to superuser
Explain it to mechilly-king-10285
05/23/2024, 3:22 PMchilly-king-10285
05/23/2024, 3:23 PMbusy-journalist-23784
05/23/2024, 3:24 PMchilly-king-10285
05/23/2024, 3:24 PMchilly-king-10285
05/23/2024, 3:25 PMjson PUT <http://localhost:4467/admin/relation-tuples/> {{ "namespace": "data-reference-app", "object": "superuser", "relation": "member", "subject_id": "user_with_email_X" }}
2. Check 'member' relation when checking permissions: When checking if 'user_with_email_X' has a certain permission, you would also need to check if they are a 'member' of 'superuser'. If they are, you would grant them the same permissions as 'superuser'. This would require modifying your permission checking logic in your application. Please note that this is a high-level overview and the exact implementation would depend on the specifics of your application and how you have set up your Ory Keto server. For more information on how to work with relation tuples in Ory Keto, you can refer to the [Ory Keto documentation](https://www.ory.sh/docs/keto/).busy-journalist-23784
05/23/2024, 3:32 PMchilly-king-10285
05/23/2024, 3:32 PMchilly-king-10285
05/23/2024, 3:32 PMjson PUT <http://localhost:4467/admin/relation-tuples/> {{ "namespace": "roles", "object": "admin", "relation": "member", "subject_id": "user_with_email_X" }}
In this example, 'user_with_email_X' is the user's email and 'admin' is the role. The 'relation' is 'member', indicating that the user is a member of the 'admin' role. To check a user's role, you would use the keto relation-tuple get
command with the user's email as the --subject-id
parameter. Here's an example: bash keto relation-tuple get --subject-id=user_with_email_X --relation=member --format json --read-remote localhost:4466
This command would return a list of all relation tuples where the user is the subject, allowing you to determine their role. Please replace 'user_with_email_X' with the actual email of the user. For more information on how to work with relation tuples in Ory Keto, you can refer to the [Ory Keto documentation](https://www.ory.sh/docs/keto/guides/rbac#creating-relationships).