mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Let's have a working helper
This commit is contained in:
parent
729aeb2425
commit
9e1cc92ce8
1 changed files with 10 additions and 3 deletions
|
@ -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"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue