From d114b0ca41cbacc363436bca2f68e2580dc68849 Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Thu, 30 May 2024 13:19:42 +0200 Subject: [PATCH] System: High Availability: Settings: remove legacy page and switch acl/menu for https://github.com/opnsense/core/issues/7485 --- plist | 1 - .../mvc/app/models/OPNsense/Core/ACL/ACL.xml | 3 +- .../app/models/OPNsense/Core/Menu/Menu.xml | 2 +- src/www/system_hasync.php | 308 ------------------ 4 files changed, 3 insertions(+), 311 deletions(-) delete mode 100644 src/www/system_hasync.php diff --git a/plist b/plist index 027036a30..8663f03df 100644 --- a/plist +++ b/plist @@ -2175,7 +2175,6 @@ /usr/local/www/system_gateway_groups_edit.php /usr/local/www/system_general.php /usr/local/www/system_groupmanager.php -/usr/local/www/system_hasync.php /usr/local/www/system_usermanager.php /usr/local/www/system_usermanager_addprivs.php /usr/local/www/system_usermanager_import_ldap.php diff --git a/src/opnsense/mvc/app/models/OPNsense/Core/ACL/ACL.xml b/src/opnsense/mvc/app/models/OPNsense/Core/ACL/ACL.xml index f4c1c402e..8beb16b24 100644 --- a/src/opnsense/mvc/app/models/OPNsense/Core/ACL/ACL.xml +++ b/src/opnsense/mvc/app/models/OPNsense/Core/ACL/ACL.xml @@ -642,7 +642,8 @@ System: High Availability - system_hasync.php* + ui/core/hasync + api/core/hasync/* diff --git a/src/opnsense/mvc/app/models/OPNsense/Core/Menu/Menu.xml b/src/opnsense/mvc/app/models/OPNsense/Core/Menu/Menu.xml index 9cc933e06..9317fab7c 100644 --- a/src/opnsense/mvc/app/models/OPNsense/Core/Menu/Menu.xml +++ b/src/opnsense/mvc/app/models/OPNsense/Core/Menu/Menu.xml @@ -57,7 +57,7 @@ - + diff --git a/src/www/system_hasync.php b/src/www/system_hasync.php deleted file mode 100644 index f634bc3a9..000000000 --- a/src/www/system_hasync.php +++ /dev/null @@ -1,308 +0,0 @@ - - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -require_once("guiconfig.inc"); -require_once("interfaces.inc"); - -$a_hasync = &config_read_array('hasync'); - -$checkbox_names = [ - 'disablepreempt', - 'disconnectppps', - 'pfsyncenabled', -]; - -$syncplugins = plugins_xmlrpc_sync(); - -foreach (array_keys($syncplugins) as $key) { - $checkbox_names[] = 'synchronize'.$key; -} - -if ($_SERVER['REQUEST_METHOD'] === 'GET') { - $pconfig = []; - foreach ($checkbox_names as $name) { - if (isset($a_hasync[$name])) { - $pconfig[$name] = $a_hasync[$name]; - } else { - $pconfig[$name] = null; - } - } - foreach (['pfsyncpeerip', 'pfsyncinterface', 'synchronizetoip', 'username', 'password'] as $tag) { - if (isset($a_hasync[$tag])) { - $pconfig[$tag] = $a_hasync[$tag]; - } else { - $pconfig[$tag] = null; - } - } -} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') { - $input_errors = []; - $pconfig = $_POST; - - foreach ($checkbox_names as $name) { - if (isset($pconfig[$name])) { - $a_hasync[$name] = $pconfig[$name]; - } else { - $a_hasync[$name] = false; - } - } - - if (!empty($pconfig['pfsyncpeerip']) && !is_ipaddrv4($pconfig['pfsyncpeerip'])) { - $input_errors[] = gettext('The synchronize peer IP must be an IPv4 address or left empty.'); - } - - if (!count($input_errors)) { - $a_hasync['pfsyncinterface'] = $pconfig['pfsyncinterface']; - $a_hasync['synchronizetoip'] = $pconfig['synchronizetoip']; - $a_hasync['username'] = $pconfig['username']; - $a_hasync['password'] = $pconfig['password']; - - if (!empty($pconfig['pfsyncpeerip'])) { - $a_hasync['pfsyncpeerip'] = $pconfig['pfsyncpeerip']; - } elseif (isset($a_hasync['pfsyncpeerip'])) { - unset($a_hasync['pfsyncpeerip']); - } - - write_config('Updated High Availability configuration'); - interfaces_carp_setup(); - - header(url_safe('Location: /system_hasync.php')); - exit; - } -} - -legacy_html_escape_form_data($pconfig); - -include("head.inc"); - -?> - - - - - -
-
-
-
- -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- /> - -
- /> - -
- /> - -
- - -
- - -
-
-
-
-
- - - - - - - - - - - - - - - - -
- - -
- - -
- - -
- - -
-
-
-
-
- - - - - - - $synccnf):?> - - - - - -
- - - - -
- /> - -
-
-
-
-
- - - - - -
- - -
-
-
-
-
-
-
-
- - -