1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/snserver_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:51:33 +01:00
parent 0270c2be30
commit 02b9a68981
No known key found for this signature in database
GPG key ID: 23DFA025BB4E9FAB
3 changed files with 11 additions and 26 deletions

View file

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

View file

@ -52,7 +52,6 @@ ynh_script_progression --message="Storing installation settings..." --weight=3
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=access_domain --value=$access_domain
ynh_app_setting_set --app=$app --key=mail --value=$mail
redis_db=$(ynh_redis_get_free_db)
@ -270,11 +269,13 @@ ynh_add_fail2ban_config --use_template --others_var="\
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring SSOwat..." --weight=3
# Make app public if necessary or protect it
# Make app public if necessary
if [ $is_public -eq 1 ]
then
# Create the visitors permission if needed
ynh_permission_update --permission "main" --add "visitors" --remove "all_users"
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors" --remove="all_users"
fi
#=================================================

View file

@ -20,7 +20,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)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
@ -63,13 +62,11 @@ ynh_abort_if_errors
#=================================================
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 db_name doesn't exist, create it
@ -365,19 +362,6 @@ ynh_add_fail2ban_config --use_template --others_var="\
path_url \
"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Upgrading SSOwat configuration..." --weight=1
# Make app public if necessary or protect it
if [ $is_public -eq 1 ]
then
# Create the visitors permission if needed
if ! ynh_permission_exists --permission "main"; then
ynh_permission_create --permission "main" --allowed "visitors"
fi
fi
#=================================================
# START SYSTEMD SERVICE
#=================================================