2018-12-30 15:58:45 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
# Source YunoHost helpers
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
# Stop script if errors
|
|
|
|
ynh_abort_if_errors
|
|
|
|
|
|
|
|
# Retrieve arguments
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
domain=$YNH_APP_ARG_DOMAIN
|
2020-04-06 14:57:39 +02:00
|
|
|
domain_2=$YNH_APP_ARG_DOMAIN_2
|
2018-12-30 15:58:45 +01:00
|
|
|
path_url=$(ynh_normalize_url_path $YNH_APP_ARG_PATH)
|
|
|
|
admin_user=$YNH_APP_ARG_ADMIN
|
2019-09-23 20:53:27 +02:00
|
|
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
2018-12-30 15:58:45 +01:00
|
|
|
|
2019-12-27 15:49:33 +01:00
|
|
|
ynh_app_setting_set --app $app --key admin_user --value $admin_user
|
2020-04-06 14:57:39 +02:00
|
|
|
ynh_app_setting_set --app $app --key domain_2 --value $domain_2
|
2019-12-27 15:49:33 +01:00
|
|
|
|
2018-12-30 15:58:45 +01:00
|
|
|
# Check domain/path availability
|
|
|
|
ynh_webpath_available $domain $path_url || ynh_die "$domain$path_url is not available, please use an other domain or path."
|
|
|
|
ynh_webpath_register $app $domain $path_url
|
|
|
|
|
2020-04-06 14:57:39 +02:00
|
|
|
ynh_permission_create --permission "admin" --url "/admin" --allowed "$admin_user" --label "Testing app admin" --protected true --show_tile true --auth_header true
|
|
|
|
ynh_permission_create --permission "dev" --url "/dev" --additional_urls "/dev2" "/otherdev" "$domain_2/" --protected false --show_tile false --auth_header false
|
|
|
|
ynh_permission_create --permission "test" --protected false
|
|
|
|
ynh_permission_create --permission "trybreakssowat_1" --url "re:/break[a-z]*/" --protected false --show_tile true --auth_header true
|
|
|
|
ynh_permission_create --permission "trybreakssowat_2" --protected false --show_tile true --auth_header true
|
2019-09-23 20:53:27 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# SETUP SSOWAT
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Configuring SSOwat..." --weight=1
|
|
|
|
|
|
|
|
# Make app public if necessary or protect it
|
2019-11-29 14:16:21 +01:00
|
|
|
[ $is_public -eq 0 ] || ynh_permission_update --permission "main" --add "visitors"
|