NORY-36: refactor admin-role script to curl command

This commit is contained in:
Markus Thielker 2024-12-17 18:14:21 +01:00
parent 1e93ced78b
commit 9d5e19a91e
No known key found for this signature in database

View file

@ -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."
# write success response to terminal
echo "Applied admin role to the user with ID $IDENTITY_ID"