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:
parent
0270c2be30
commit
02b9a68981
3 changed files with 11 additions and 26 deletions
|
@ -13,7 +13,7 @@
|
||||||
"email": "46000361+FabianWilkens@users.noreply.github.com"
|
"email": "46000361+FabianWilkens@users.noreply.github.com"
|
||||||
},
|
},
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 4.1.0"
|
"yunohost": ">= 4.1.2"
|
||||||
},
|
},
|
||||||
"multi_instance": true,
|
"multi_instance": true,
|
||||||
"services": [
|
"services": [
|
||||||
|
|
|
@ -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=domain --value=$domain
|
||||||
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
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=access_domain --value=$access_domain
|
||||||
ynh_app_setting_set --app=$app --key=mail --value=$mail
|
ynh_app_setting_set --app=$app --key=mail --value=$mail
|
||||||
redis_db=$(ynh_redis_get_free_db)
|
redis_db=$(ynh_redis_get_free_db)
|
||||||
|
@ -270,11 +269,13 @@ ynh_add_fail2ban_config --use_template --others_var="\
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring SSOwat..." --weight=3
|
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 ]
|
if [ $is_public -eq 1 ]
|
||||||
then
|
then
|
||||||
# Create the visitors permission if needed
|
# Everyone can access the app.
|
||||||
ynh_permission_update --permission "main" --add "visitors" --remove "all_users"
|
# The "main" permission is automatically created before the install script.
|
||||||
|
ynh_permission_update --permission="main" --add="visitors" --remove="all_users"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -20,7 +20,6 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
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)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
db_user=$db_name
|
db_user=$db_name
|
||||||
|
@ -63,13 +62,11 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||||
|
|
||||||
# Fix is_public as a boolean value
|
# Cleaning legacy permissions
|
||||||
if [ "$is_public" = "Yes" ]; then
|
if ynh_legacy_permissions_exists; then
|
||||||
ynh_app_setting_set --app=$app --key=is_public --value=1
|
ynh_legacy_permissions_delete_all
|
||||||
is_public=1
|
|
||||||
elif [ "$is_public" = "No" ]; then
|
ynh_app_setting_delete --app=$app --key=is_public
|
||||||
ynh_app_setting_set --app=$app --key=is_public --value=0
|
|
||||||
is_public=0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If db_name doesn't exist, create it
|
# If db_name doesn't exist, create it
|
||||||
|
@ -365,19 +362,6 @@ ynh_add_fail2ban_config --use_template --others_var="\
|
||||||
path_url \
|
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
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue