mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Add legacy_args, fix the helper
This commit is contained in:
parent
51a0502e91
commit
90459e7ae6
2 changed files with 16 additions and 4 deletions
|
@ -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:
|
||||||
|
|
|
@ -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
|
||||||
|
@ -376,13 +386,17 @@ ynh_permission_update() {
|
||||||
#
|
#
|
||||||
# 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 an array to define the options of this helper.
|
||||||
|
local legacy_args=pu
|
||||||
declare -Ar args_array=( [p]=permission= [u]=user)
|
declare -Ar args_array=( [p]=permission= [u]=user)
|
||||||
local permission
|
local permission
|
||||||
|
local user
|
||||||
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 "$app.$permission" | grep -w -q "$user"
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue