1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/snweb_ynh.git synced 2024-09-03 20:26:22 +02:00

Update permission system

This commit is contained in:
Fabian Wilkens 2021-03-14 18:39:29 +01:00
parent 01309be981
commit 57d184e359
No known key found for this signature in database
GPG key ID: 23DFA025BB4E9FAB
3 changed files with 9 additions and 24 deletions

View file

@ -13,7 +13,7 @@
"email": "46000361+FabianWilkens@users.noreply.github.com"
},
"requirements": {
"yunohost": ">= 4.0"
"yunohost": ">= 4.1.2"
},
"multi_instance": true,
"services": [

View file

@ -53,7 +53,6 @@ ynh_script_progression --message="Storing installation settings..." --weight=2
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
ynh_app_setting_set --app=$app --key=snserver_domain --value=$snserver_domain
#=================================================
@ -231,8 +230,9 @@ ynh_script_progression --message="Configuring SSOwat..." --weight=2
# Make app public if necessary
if [ $is_public -eq 1 ]
then
# Create the visitors permission if needed
ynh_permission_update --permission "main" --add "visitors"
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors"
fi
#=================================================

View file

@ -19,7 +19,6 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port)
snserver_domain=$(ynh_app_setting_get --app=$app --key=snserver_domain)
@ -41,13 +40,11 @@ upgrade_type=$(ynh_check_app_version_changed)
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# Fix is_public as a boolean value
if [ "$is_public" = "Yes" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=1
is_public=1
elif [ "$is_public" = "No" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=0
is_public=0
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
# If final_path doesn't exist, create it
@ -260,18 +257,6 @@ sleep 10
# Create a dedicated fail2ban config
#ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Upgrading SSOwat configuration..." --weight=2
# Make app public if necessary
if [ $is_public -eq 1 ]
then
# Create the visitors permission if needed
ynh_permission_update --permission "main" --add "visitors"
fi
#=================================================
# RELOAD NGINX
#=================================================