Преглед на файлове

Merge pull request #18 from yunohost-bot/new-permission-system

[autopatch] Autopatch to migrate to new permission system
yalh76 преди 4 години
родител
ревизия
4ed230de09
променени са 2 файла, в които са добавени 12 реда и са изтрити 9 реда
  1. 2 9
      scripts/install
  2. 10 0
      scripts/upgrade

+ 2 - 9
scripts/install

@@ -59,7 +59,6 @@ ynh_script_progression --message="Get infos from manifest" -w 1
 ynh_app_setting_set "$app" domain "$domain"
 ynh_app_setting_set "$app" domain "$domain"
 ynh_app_setting_set "$app" path "$path_url"
 ynh_app_setting_set "$app" path "$path_url"
 ynh_app_setting_set "$app" admin "$admin"
 ynh_app_setting_set "$app" admin "$admin"
-ynh_app_setting_set "$app" is_public "$is_public"
 ynh_app_setting_set "$app" language "$language"
 ynh_app_setting_set "$app" language "$language"
 
 
 #=================================================
 #=================================================
@@ -362,10 +361,6 @@ yunohost service add snmpd -d "Management of SNMP Daemon"
 yunohost service add zabbix-server -d "Management Zabbix server daemon : Collect, agregate, compute and notify"
 yunohost service add zabbix-server -d "Management Zabbix server daemon : Collect, agregate, compute and notify"
 yunohost service add zabbix-agent -d "Management Zabbix agent daemon : send informations about this host to the server"
 yunohost service add zabbix-agent -d "Management Zabbix agent daemon : send informations about this host to the server"
 
 
-# Make app public if for importing template
-# unprotected_uris allows SSO credentials to be passed anyway
-#ynh_app_setting_set "$app" unprotected_uris "/"
-
 #=================================================
 #=================================================
 # RELOAD NGINX AND PHP-FPM
 # RELOAD NGINX AND PHP-FPM
 #=================================================
 #=================================================
@@ -398,11 +393,9 @@ disable_admin_user
 #=================================================
 #=================================================
 
 
 # Make app public if necessary
 # Make app public if necessary
-if [ $is_public -eq 1 ]
+if [ "$is_public" -eq 1 ]
 then
 then
-	# Everyone can access the app.
-	# The "main" permission is automatically created before the install script.
-	ynh_permission_update --permission "main" --add "visitors"
+	ynh_permission_update --permission="main" --add="visitors"
 fi
 fi
 
 
 #=================================================
 #=================================================

+ 10 - 0
scripts/upgrade

@@ -134,6 +134,16 @@ then
 	    }
 	    }
 	    # Exit if an error occurs during the execution of the script
 	    # Exit if an error occurs during the execution of the script
 	    ynh_abort_if_errors
 	    ynh_abort_if_errors
+
+#=================================================
+# Migrate legacy permissions to new system
+#=================================================
+if ynh_legacy_permissions_exists
+then
+	ynh_legacy_permissions_delete_all
+
+	ynh_app_setting_delete --app=$app --key=is_public
+fi
 	    
 	    
 	    yunohost service stop zabbix-server
 	    yunohost service stop zabbix-server
 	    yunohost service stop zabbix-agent
 	    yunohost service stop zabbix-agent