#!/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."