mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Merge pull request #868 from kay0u/fix-legacy-permission-management
fix legacy permission management
This commit is contained in:
commit
f0ef8aca79
1 changed files with 13 additions and 2 deletions
|
@ -158,6 +158,11 @@ ynh_add_protected_uris() {
|
|||
#
|
||||
ynh_app_setting()
|
||||
{
|
||||
if [[ "$1" == "delete" ]] && [[ "$3" =~ ^(unprotected|skipped)_ ]]
|
||||
then
|
||||
current_value=$(ynh_app_setting_get --app=$app --key=$3)
|
||||
fi
|
||||
|
||||
ACTION="$1" APP="$2" KEY="$3" VALUE="${4:-}" python2.7 - <<EOF
|
||||
import os, yaml, sys
|
||||
app, action = os.environ['APP'], os.environ['ACTION'].lower()
|
||||
|
@ -187,9 +192,15 @@ EOF
|
|||
|
||||
# Fucking legacy permission management.
|
||||
# We need this because app temporarily set the app as unprotected to configure it with curl...
|
||||
if [[ "$3" =~ ^(unprotected|skipped)_ ]] && [[ "${4:-}" == "/" ]]
|
||||
if [[ "$3" =~ ^(unprotected|skipped)_ ]]
|
||||
then
|
||||
ynh_permission_update --permission "main" --add "visitors"
|
||||
if [[ "$1" == "set" ]] && [[ "${4:-}" == "/" ]]
|
||||
then
|
||||
ynh_permission_update --permission "main" --add "visitors"
|
||||
elif [[ "$1" == "delete" ]] && [[ "${current_value:-}" == "/" ]]
|
||||
then
|
||||
ynh_permission_update --permission "main" --remove "visitors"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue