1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mautrix_whatsapp_ynh.git synced 2024-09-03 19:46:01 +02:00

Fix delete users with role surrounded with quotes

This commit is contained in:
Dante 2023-05-24 10:24:25 +01:00
parent b564d7b3f7
commit eca4af42b1

View file

@ -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"