mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
fix ynh_permission_has_user
This commit is contained in:
parent
66b036512b
commit
f0590907c9
1 changed files with 11 additions and 2 deletions
|
@ -362,8 +362,17 @@ ynh_permission_has_user() {
|
|||
return 1
|
||||
fi
|
||||
|
||||
yunohost user permission info "$app.$permission" --output-as json --quiet \
|
||||
| jq -e --arg user $user '.corresponding_users | index($user)' >/dev/null
|
||||
# Check both allowed and corresponding_users sections in the json
|
||||
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
|
||||
|
|
Loading…
Add table
Reference in a new issue