fix ynh_permission_has_user

This commit is contained in:
Kay0u 2021-08-14 11:44:52 +02:00
parent 66b036512b
commit f0590907c9
No known key found for this signature in database
GPG key ID: AE1DCADB6415A156

View file

@ -362,8 +362,17 @@ ynh_permission_has_user() {
return 1 return 1
fi fi
yunohost user permission info "$app.$permission" --output-as json --quiet \ # Check both allowed and corresponding_users sections in the json
| jq -e --arg user $user '.corresponding_users | index($user)' >/dev/null for section in "allowed" "corresponding_users"
do
if yunohost user permission info "$app.$permission" --output-as json --quiet \
| jq -e --arg user $user --arg section $section '.[$section] | index($user)' >/dev/null
then
return 0
fi
done
return 1
} }
# Check if a legacy permissions exist # Check if a legacy permissions exist