Add legacy_args, fix the helper

This commit is contained in:
Kay0u 2020-03-30 21:32:29 +02:00 committed by Alexandre Aubin
parent 9e1cc92ce8
commit 3e6cbe4e84
2 changed files with 11 additions and 3 deletions

View file

@ -303,8 +303,6 @@ user:
arguments: arguments:
permission: permission:
help: Name of the permission to fetch info about help: Name of the permission to fetch info about
extra:
pattern: *pattern_username
### user_permission_update() ### user_permission_update()
update: update:

View file

@ -270,6 +270,8 @@ ynh_webpath_register () {
# #
# Requires YunoHost version 3.7.0 or higher. # Requires YunoHost version 3.7.0 or higher.
ynh_permission_create() { ynh_permission_create() {
# Declare an array to define the options of this helper.
local legacy_args=pua
declare -Ar args_array=( [p]=permission= [u]=url= [a]=allowed= ) declare -Ar args_array=( [p]=permission= [u]=url= [a]=allowed= )
local permission local permission
local url local url
@ -298,6 +300,8 @@ ynh_permission_create() {
# #
# Requires YunoHost version 3.7.0 or higher. # Requires YunoHost version 3.7.0 or higher.
ynh_permission_delete() { ynh_permission_delete() {
# Declare an array to define the options of this helper.
local legacy_args=p
declare -Ar args_array=( [p]=permission= ) declare -Ar args_array=( [p]=permission= )
local permission local permission
ynh_handle_getopts_args "$@" ynh_handle_getopts_args "$@"
@ -312,6 +316,8 @@ ynh_permission_delete() {
# #
# Requires YunoHost version 3.7.0 or higher. # Requires YunoHost version 3.7.0 or higher.
ynh_permission_exists() { ynh_permission_exists() {
# Declare an array to define the options of this helper.
local legacy_args=p
declare -Ar args_array=( [p]=permission= ) declare -Ar args_array=( [p]=permission= )
local permission local permission
ynh_handle_getopts_args "$@" ynh_handle_getopts_args "$@"
@ -327,6 +333,8 @@ ynh_permission_exists() {
# #
# Requires YunoHost version 3.7.0 or higher. # Requires YunoHost version 3.7.0 or higher.
ynh_permission_url() { ynh_permission_url() {
# Declare an array to define the options of this helper.
local legacy_args=pu
declare -Ar args_array=([p]=permission= [u]=url=) declare -Ar args_array=([p]=permission= [u]=url=)
local permission local permission
local url local url
@ -352,6 +360,8 @@ ynh_permission_url() {
# example: ynh_permission_update --permission admin --add samdoe --remove all_users # example: ynh_permission_update --permission admin --add samdoe --remove all_users
# Requires YunoHost version 3.7.0 or higher. # Requires YunoHost version 3.7.0 or higher.
ynh_permission_update() { ynh_permission_update() {
# Declare an array to define the options of this helper.
local legacy_args=par
declare -Ar args_array=( [p]=permission= [a]=add= [r]=remove= ) declare -Ar args_array=( [p]=permission= [a]=add= [r]=remove= )
local permission local permission
local add local add
@ -391,5 +401,5 @@ ynh_permission_has_user() {
return 1 return 1
fi fi
yunohost user permission info $permission | grep -w -q "$user" yunohost user permission info "$app.$permission" | grep -w -q "$user"
} }