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 # set user id variable
IDENTITY_ID=$1 IDENTITY_ID=$1
# execute Ory Keto CLI command to make user an admin # execute curl to Ory Keto write endpoint
docker compose exec ory-keto \ curl --request PUT \
ory create relation-tuples \ --url http://localhost:4467/admin/relation-tuples \
\{'namespace':'roles','object':'admin','relation':'member','subject_id':IDENTITY_ID} --data '{
"namespace": "roles",
"object": "admin",
"relation": "member",
"subject_id": "'"$IDENTITY_ID"'"
}'
# respond with success message # write success response to terminal
echo "Identity $IDENTITY_ID was given the admin role." echo "Applied admin role to the user with ID $IDENTITY_ID"