diff --git a/manifest.json b/manifest.json index 2d7a9d7..e159690 100644 --- a/manifest.json +++ b/manifest.json @@ -48,6 +48,15 @@ "type": "user", "example": "homer" }, + { + "name": "is_public", + "type": "boolean", + "help": { + "en": "If enabled, Nextcloud will be accessible by Nextcloud Desktop and by users without a YunoHost account. This can be changed later in the webadmin.", + "fr": "Si cette case est cochée, Nextcloud sera accessible par Nextcloud Desktop et par les utilisateurs n’ayant pas de compte YunoHost. Vous pourrez changer dans la webadmin." + }, + "default": true + }, { "name": "user_home", "type": "boolean", diff --git a/scripts/install b/scripts/install index 1ca2fc6..c36b120 100755 --- a/scripts/install +++ b/scripts/install @@ -24,6 +24,7 @@ domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH admin=$YNH_APP_ARG_ADMIN user_home=$YNH_APP_ARG_USER_HOME +is_public=$YNH_APP_ARG_IS_PUBLIC app=$YNH_APP_INSTANCE_NAME @@ -331,7 +332,13 @@ ynh_add_fail2ban_config --logpath="/home/yunohost.app/$app/data/nextcloud.log" - #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring SSOwat..." +ynh_script_progression --message="Configuring permissions..." + +# Make app public if necessary +if [ $is_public -eq 1 ] +then + ynh_permission_update --permission="main" --add="visitors" +fi ynh_permission_create --permission="api" --label="api" --url="re:$domain\/.well-known\/.*" --allowed="visitors" "all_users" --auth_header="false" --show_tile="false" --protected="true" diff --git a/scripts/upgrade b/scripts/upgrade index 175c4ee..8968143 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -70,6 +70,13 @@ if [ -z "$phpversion" ]; then phpversion="$YNH_PHP_VERSION" fi +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #=================================================