mirror of
https://github.com/YunoHost-Apps/spip_ynh.git
synced 2024-09-03 20:25:59 +02:00
tmp fix ynh_permission_has_user
This commit is contained in:
parent
93e29aa41a
commit
14237a512d
3 changed files with 30 additions and 1 deletions
|
@ -6,7 +6,7 @@
|
||||||
"en": "CMS with a focus on collaborative edition and multilingualism",
|
"en": "CMS with a focus on collaborative edition and multilingualism",
|
||||||
"fr": "CMS conçu pour l'édition collaborative et le multilinguisme"
|
"fr": "CMS conçu pour l'édition collaborative et le multilinguisme"
|
||||||
},
|
},
|
||||||
"version": "4.0.0~ynh1",
|
"version": "4.0.0~ynh2",
|
||||||
"url": "http://www.spip.net/",
|
"url": "http://www.spip.net/",
|
||||||
"license": "GPL-3.0-or-later",
|
"license": "GPL-3.0-or-later",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
|
|
28
scripts/_ynh_permission_has_user.sh
Normal file
28
scripts/_ynh_permission_has_user.sh
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
ynh_permission_has_user() {
|
||||||
|
local legacy_args=pu
|
||||||
|
# Declare an array to define the options of this helper.
|
||||||
|
local -A args_array=( [p]=permission= [u]=user= )
|
||||||
|
local permission
|
||||||
|
local user
|
||||||
|
# Manage arguments with getopts
|
||||||
|
ynh_handle_getopts_args "$@"
|
||||||
|
|
||||||
|
if ! ynh_permission_exists --permission=$permission
|
||||||
|
then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 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
|
||||||
|
}
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
source _ynh_permission_has_user.sh
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
|
|
Loading…
Reference in a new issue