Files
query-orchestration/cmd/auth_related/permit.setup/cleanup_default_roles.sh
T
Jay Brown 6dccf494f8 Merged in feature/permit-policy-cleanup (pull request #210)
cleanup permit policies and correct documentation

* docs

* policy cleanup

* refactor

* Merge remote-tracking branch 'origin/feature/permit-policy-cleanup' into feature/permit-policy-cleanup

* docs and edits
2026-02-19 20:22:59 +00:00

36 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Delete the default Permit.io roles that conflict with our resource names.
# Only run this on a brand new environment since it creates conflicting roles to start that need
# to be deleted.
export PERMIT_API_KEY="permit_key_omitted"
PROJECT_ID="default"
ENV_ID="production"
echo "Deleting conflicting default roles from Production environment..."
echo ""
# Delete the 'admin' role
echo "Deleting 'admin' role..."
curl -X DELETE "https://api.permit.io/v2/schema/${PROJECT_ID}/${ENV_ID}/roles/admin" \
-H "Authorization: Bearer ${PERMIT_API_KEY}" \
-H "Content-Type: application/json"
echo ""
# Delete the 'editor' role (doesn't conflict but keeping consistency)
echo "Deleting 'editor' role..."
curl -X DELETE "https://api.permit.io/v2/schema/${PROJECT_ID}/${ENV_ID}/roles/editor" \
-H "Authorization: Bearer ${PERMIT_API_KEY}" \
-H "Content-Type: application/json"
echo ""
# Delete the 'viewer' role (doesn't conflict but keeping consistency)
echo "Deleting 'viewer' role..."
curl -X DELETE "https://api.permit.io/v2/schema/${PROJECT_ID}/${ENV_ID}/roles/viewer" \
-H "Authorization: Bearer ${PERMIT_API_KEY}" \
-H "Content-Type: application/json"
echo ""
echo "Done! You can now run the setup script."