diff --git a/permissions_app_ynh/manifest.json b/permissions_app_ynh/manifest.json index 7c3b36a..8a1755b 100644 --- a/permissions_app_ynh/manifest.json +++ b/permissions_app_ynh/manifest.json @@ -33,6 +33,19 @@ "example": "/permissions_app", "default": "/permissions_app" }, + { + "name": "is_public", + "type": "boolean", + "ask": { + "en": "Is it a public application?", + "fr": "Est-ce une application publique ?" + }, + "help": { + "en": "A private app will only be accessible to logged-in users", + "fr": "Une app privée sera seulement accessible aux utilisateurs connectés" + }, + "default": true + }, { "name": "admin", "type": "user", diff --git a/permissions_app_ynh/scripts/change_url b/permissions_app_ynh/scripts/change_url index 6686f73..94dd777 100644 --- a/permissions_app_ynh/scripts/change_url +++ b/permissions_app_ynh/scripts/change_url @@ -10,12 +10,4 @@ source /usr/share/yunohost/helpers # Stop script if errors ynh_abort_if_errors -# Retrive arguments -app=$YNH_APP_INSTANCE_NAME -old_domain=$YNH_APP_OLD_DOMAIN -old_path_url=$(ynh_normalize_url_path ${YNH_APP_OLD_PATH}) -domain=$YNH_APP_NEW_DOMAIN -path_url=$(ynh_normalize_url_path ${YNH_APP_NEW_PATH}) - -ynh_permission_urls --permission "admin" --remove "$old_domain$old_path_url/admin" --add "$domain$path_url/admin" -ynh_permission_urls --permission "dev" --remove "$old_domain$old_path_url/dev" --add "$domain$path_url/dev" +# Nothing to do ... Permission using relative urls don't need to be changed, only the domain/path setting (handled in the core) diff --git a/permissions_app_ynh/scripts/install b/permissions_app_ynh/scripts/install index a24b367..d49f374 100644 --- a/permissions_app_ynh/scripts/install +++ b/permissions_app_ynh/scripts/install @@ -15,13 +15,22 @@ 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 # 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" --urls "$domain$path_url/admin" +ynh_permission_create --permission "admin" --urls "/admin" ynh_permission_update --permission "admin" --add "$admin_user" ynh_permission_create --permission "dev" -ynh_permission_urls --permission "dev" --add "$domain$path_url/dev" +ynh_permission_urls --permission "dev" --add "/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"