From 9d5e19a91e2a3646f355b36eecfc09419170072f Mon Sep 17 00:00:00 2001 From: Markus Thielker Date: Tue, 17 Dec 2024 18:14:21 +0100 Subject: [PATCH] NORY-36: refactor admin-role script to curl command --- docker/ory-dev/keto-make-admin.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/docker/ory-dev/keto-make-admin.sh b/docker/ory-dev/keto-make-admin.sh index cb60efe..a08624b 100644 --- a/docker/ory-dev/keto-make-admin.sh +++ b/docker/ory-dev/keto-make-admin.sh @@ -10,10 +10,15 @@ fi # set user id variable IDENTITY_ID=$1 -# execute Ory Keto CLI command to make user an admin -docker compose exec ory-keto \ - ory create relation-tuples \ - \{'namespace':'roles','object':'admin','relation':'member','subject_id':IDENTITY_ID} +# execute curl to Ory Keto write endpoint +curl --request PUT \ + --url http://localhost:4467/admin/relation-tuples \ + --data '{ + "namespace": "roles", + "object": "admin", + "relation": "member", + "subject_id": "'"$IDENTITY_ID"'" + }' -# respond with success message -echo "Identity $IDENTITY_ID was given the admin role." \ No newline at end of file +# write success response to terminal +echo "Applied admin role to the user with ID $IDENTITY_ID"