test_apps/permissions_app_ynh/scripts/install

35 lines
1.1 KiB
Text
Raw Normal View History

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
path_url=$(ynh_normalize_url_path $YNH_APP_ARG_PATH)
admin_user=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC
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
ynh_permission_create --permission "admin" --url "/admin" --allowed "$admin_user"
2018-12-30 15:58:45 +01:00
ynh_permission_create --permission "dev" --url "/dev"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring SSOwat..." --weight=1
# Make app public if necessary or protect it
[ $is_public -eq 0 ] || ynh_permission_update --permission "main" --remove "all_users" --add "visitors"