From 4d341cf8e493356e160d2173c9528c435f6fd764 Mon Sep 17 00:00:00 2001 From: jasquat Date: Mon, 27 Mar 2023 14:09:08 -0400 Subject: [PATCH] do not allow uploading a user to keycloak that matches admin user that the script is using w/ burnettk --- .../keycloak/bin/add_test_users_to_keycloak | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spiffworkflow-backend/keycloak/bin/add_test_users_to_keycloak b/spiffworkflow-backend/keycloak/bin/add_test_users_to_keycloak index 4196add0..c53fe438 100755 --- a/spiffworkflow-backend/keycloak/bin/add_test_users_to_keycloak +++ b/spiffworkflow-backend/keycloak/bin/add_test_users_to_keycloak @@ -89,6 +89,12 @@ while read -r input_line; do echo "Importing: $input_line" user_email=$(awk -F ',' '{print $1}' <<<"$input_line") username=$(awk -F '@' '{print $1}' <<<"$user_email") + + if [[ "$username" == "$ADMIN_USERNAME" || "$user_email" == "$ADMIN_USERNAME" ]]; then + >&2 echo "ERROR: The user used as the admin user matches a user in the current import list. This should not happen. Comment out that user from the list or use a different admin user: ${ADMIN_USERNAME}" + exit 1 + fi + user_attribute_one=$(awk -F ',' '{print $2}' <<<"$input_line") http_code=$(add_user "$user_email" "$username" "$user_attribute_one")