From eca4af42b15ccf6b289fcc959f2f11792f8a5520 Mon Sep 17 00:00:00 2001 From: Dante Date: Wed, 24 May 2023 10:24:25 +0100 Subject: [PATCH] Fix delete users with role surrounded with quotes --- scripts/_common.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/_common.sh b/scripts/_common.sh index 1aa2562..1431a9f 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -25,6 +25,8 @@ apply_permissions() { allDefinedEntries=$(awk '/permissions:/{flag=1; next} /relay:/{flag=0} flag' "$final_path/config.yaml" | sed "/: $role/d" | sed -r 's/: (admin|user|relay)//' | tr -d '[:blank:]' | sed '/^#/d' | tr -d '\"' | tr ',' '\n' ) # Delete everything from the corresponding role to insert the new defined values. This way we also handle deletion of users. sed -i "/permissions:/,/relay:/{/: $role/d;}" "$final_path/config.yaml" + # Ensure that entries with value surrounded with quotes are deleted too. E.g. "users". + sed -i "/permissions:/,/relay:/{/: \"$role\"/d;}" "$final_path/config.yaml" for user in "${usersArray[@]}" do if grep -q -x "${user}" <<< "$allDefinedEntries"