Let's have a working helper

This commit is contained in:
Maniack Crudelis 2020-03-30 19:58:06 +02:00 committed by Alexandre Aubin
parent 729aeb2425
commit 9e1cc92ce8

View file

@ -374,15 +374,22 @@ ynh_permission_update() {
# | arg: -p, --permission - the permission to check # | arg: -p, --permission - the permission to check
# | arg: -u, --user - the user seek in the permission # | arg: -u, --user - the user seek in the permission
# #
# example: ynh_permission_has_user --permission=nextcloud.main --user=visitors
#
# Requires YunoHost version 3.7.1 or higher. # Requires YunoHost version 3.7.1 or higher.
ynh_permission_has_user() { ynh_permission_has_user() {
declare -Ar args_array=( [p]=permission= [u]=user) local legacy_args=pu
# Declare an array to define the options of this helper.
declare -Ar args_array=( [p]=permission= [u]=user= )
local permission local permission
local user
# Manage arguments with getopts
ynh_handle_getopts_args "$@" ynh_handle_getopts_args "$@"
if ! ynh_permission_exists --permission $permission if ! ynh_permission_exists --permission=$permission
then
return 1 return 1
fi fi
yunohost user permission info $permission | grep -w -q "$user" yunohost user permission info $permission | grep -w -q "$user"
} }