All checks were successful
Deploy netdiag / deploy (push) Successful in 14s
PDF-Zweig netdiagPdfSip()
- Eigener Zweig, weil die Aussage sonst untergeht: in einer flachen
Schluessel/Wert-Liste sieht "401 Unauthorized" wie ein Fehler aus, ist aber
der Beweis fuer eine erreichbare Instanz, die nur Zugangsdaten will. Erst
Befund im Klartext, dann eine Zeile je Transportweg.
- Der Grenzhinweis steht mit im Dokument: gemessen ist die Erreichbarkeit,
NICHT die Sprachqualitaet.
- Feldnamen-Falle wieder aufgetreten: 'port' gehoert in beiden Feldtabellen
laengst dem SNMP-Werkzeug ("Switch-Port"). Im Kunden-PDF haette gestanden
"Switch-Port: 5060" - deshalb 'zielPort'.
WLAN-Kanalanalyse: Warnungen nicht mehr abschneiden
- dol_trunc(..., 160) kappte genau die Begruendung ("... In dicht besiedelter
Umgebung meist ein Fehle..."). Eine Warnung ohne ihren Grund ist im
Kundendokument wertlos; MultiCell bricht ohnehin um.
Token in der Adresszeile
- netdiag_api_read_token() nimmt ?jwt= nur noch an, wenn der Endpunkt es
ausdruecklich erlaubt. Einzige Stelle: update.php?download=1.
- Grund: ein Token in der URL steht in jedem Zugriffs- und Proxy-Log und gilt
sieben Tage fuer die GESAMTE Kunden-API.
- Warum die Ausnahme bleibt: die App-Fassungen im Feld bauen die
Download-Adresse mit dem Token darin. Sofort schliessen hiesse, genau die
Geraete vom Update auszusperren, die die neue APK brauchen. Zu entfernen,
sobald Eddy den Rollout bestaetigt (Hinweis steht im Code).
- pdf.php nimmt ab sofort ausschliesslich den Authorization-Header.
Gegen die Testinstanz gemessen: ?jwt= liefert bei orders/customers/protocols/
pdf/update-Version jetzt 401, mit Bearer weiterhin 200.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
243 lines
7.7 KiB
PHP
243 lines
7.7 KiB
PHP
<?php
|
|
/* Copyright (C) 2026 Eduard Wisch <data@data-it-solution.de>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
/**
|
|
* \defgroup netdiag Modul NetDiag
|
|
* \brief NetDiag Modul-Descriptor — Netzwerk-Diagnose-Protokolle.
|
|
* \file htdocs/custom/netdiag/core/modules/modNetDiag.class.php
|
|
* \ingroup netdiag
|
|
* \brief Beschreibungs- und Aktivierungsdatei für das Modul NetDiag
|
|
*/
|
|
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
|
|
|
|
|
|
/**
|
|
* Beschreibungs- und Aktivierungsklasse für das Modul NetDiag
|
|
*
|
|
* NetDiag speichert Netzwerk-Diagnose-Protokolle (IP-Scan, Port-Scan, Ping,
|
|
* WLAN, DHCP, SNMP, Durchsatz, Stresstest) und hängt sie an Kunde und Auftrag.
|
|
* Die JSON-API unter /custom/netdiag/api/ versorgt die mobile Diagnose-App.
|
|
*/
|
|
class modNetDiag extends DolibarrModules
|
|
{
|
|
/**
|
|
* Konstruktor. Definiert Namen, Konstanten, Verzeichnisse, Rechte, Menüs.
|
|
*
|
|
* @param DoliDB $db Datenbank-Handler
|
|
*/
|
|
public function __construct($db)
|
|
{
|
|
global $conf, $langs;
|
|
|
|
$this->db = $db;
|
|
|
|
// Eindeutige Modul-ID — 500300 frei (500100 belegt globalnotify, 500200 stundenzettel)
|
|
$this->numero = 500300;
|
|
|
|
// Schlüsseltext zur Identifikation (Rechte, Menüs, ...)
|
|
$this->rights_class = 'netdiag';
|
|
|
|
// Familie: 'technic' = transversales/technisches Modul
|
|
$this->family = "technic";
|
|
$this->module_position = '90';
|
|
|
|
// Modul-Label (ohne Leerzeichen), Fallback wenn Übersetzung 'ModuleNetDiagName' fehlt
|
|
$this->name = preg_replace('/^mod/i', '', get_class($this));
|
|
|
|
// Modulbeschreibung, Fallback wenn Übersetzung 'ModuleNetDiagDesc' fehlt
|
|
$this->description = "ModuleNetDiagDesc";
|
|
$this->descriptionlong = "Netzwerk-Diagnose-Protokolle: erfasst per mobiler App Geräte, Ports, Messungen und hängt sie an Kunde und Auftrag.";
|
|
|
|
// Autor
|
|
$this->editor_name = 'Alles Watt läuft';
|
|
$this->editor_url = '';
|
|
$this->editor_squarred_logo = '';
|
|
|
|
$this->version = '1.3.0';
|
|
|
|
// Konstanten-Name in llx_const für Modul-Status
|
|
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
|
|
|
// Icon (Font-Awesome)
|
|
$this->picto = 'fa-network-wired';
|
|
|
|
// Vom Modul unterstützte Funktionen
|
|
$this->module_parts = array(
|
|
'triggers' => 0,
|
|
'login' => 0,
|
|
'substitutions' => 0,
|
|
'menus' => 0,
|
|
'tpl' => 0,
|
|
'barcode' => 0,
|
|
'models' => 1,
|
|
'printing' => 0,
|
|
'theme' => 0,
|
|
'css' => array(),
|
|
'js' => array(),
|
|
'hooks' => array(),
|
|
'moduleforexternal' => 0,
|
|
'websitetemplates' => 0,
|
|
'captcha' => 0,
|
|
);
|
|
|
|
// Datenverzeichnisse, die beim Aktivieren angelegt werden
|
|
$this->dirs = array("/netdiag/temp");
|
|
|
|
// Konfigurationsseiten (in netdiag/admin)
|
|
$this->config_page_url = array("setup.php@netdiag");
|
|
|
|
// Abhängigkeiten
|
|
$this->hidden = false;
|
|
$this->depends = array();
|
|
$this->requiredby = array();
|
|
$this->conflictwith = array();
|
|
|
|
// Sprachdatei des Moduls
|
|
$this->langfiles = array("netdiag@netdiag");
|
|
|
|
// Voraussetzungen
|
|
$this->phpmin = array(7, 4);
|
|
$this->need_dolibarr_version = array(19, -3);
|
|
$this->need_javascript_ajax = 0;
|
|
|
|
$this->warnings_activation = array();
|
|
$this->warnings_activation_ext = array();
|
|
|
|
// Konstanten beim Aktivieren anlegen
|
|
// (Key, Typ, Wert, Beschreibung, sichtbar, current/allentities, deleteonunactive)
|
|
$this->const = array(
|
|
// NETDIAG_API_JWT_SECRET und NETDIAG_API_TOKEN_TTL sind am 17.08.2026
|
|
// entfallen: die Anmeldung läuft ausschließlich über awlauth, die
|
|
// Gültigkeit bestimmt dort AWLAUTH_TTL. Bestehende Werte in llx_const
|
|
// werden bewusst NICHT gelöscht — sie schaden nicht, und ein
|
|
// Löschlauf beim Modul-Update ist das größere Risiko.
|
|
1 => array('NETDIAG_APK_URL', 'chaine', 'https://git.data-it-solution.de/api/packages/data-it/generic/netdiag-apk/latest/NetDiag.apk', 'Download-URL der Android-App (für QR-Code im Admin)', 1, 'current', 0),
|
|
);
|
|
|
|
if (!isModEnabled("netdiag")) {
|
|
$conf->netdiag = new stdClass();
|
|
$conf->netdiag->enabled = 0;
|
|
}
|
|
|
|
// Neue Tabs an bestehenden Objekten
|
|
// Tab "Netzwerk-Diagnose" an Kunde (thirdparty) und Auftrag (order)
|
|
$this->tabs = array(
|
|
'thirdparty:+netdiag:NetDiagTab:netdiag@netdiag:$user->hasRight(\'netdiag\', \'protocol\', \'read\'):/custom/netdiag/netdiag_object_tab.php?socid=__ID__&objecttype=thirdparty',
|
|
'order:+netdiag:NetDiagTab:netdiag@netdiag:$user->hasRight(\'netdiag\', \'protocol\', \'read\'):/custom/netdiag/netdiag_object_tab.php?id=__ID__&objecttype=order',
|
|
);
|
|
|
|
$this->dictionaries = array();
|
|
$this->boxes = array();
|
|
$this->cronjobs = array();
|
|
|
|
// Rechte
|
|
$this->rights = array();
|
|
$r = 0;
|
|
$o = 1;
|
|
|
|
$this->rights[$r][0] = $this->numero.sprintf("%02d", ($o * 10) + 1);
|
|
$this->rights[$r][1] = 'Diagnose-Protokolle lesen';
|
|
$this->rights[$r][4] = 'protocol';
|
|
$this->rights[$r][5] = 'read';
|
|
$r++;
|
|
|
|
$this->rights[$r][0] = $this->numero.sprintf("%02d", ($o * 10) + 2);
|
|
$this->rights[$r][1] = 'Diagnose-Protokolle anlegen/ändern';
|
|
$this->rights[$r][4] = 'protocol';
|
|
$this->rights[$r][5] = 'write';
|
|
$r++;
|
|
|
|
$this->rights[$r][0] = $this->numero.sprintf("%02d", ($o * 10) + 3);
|
|
$this->rights[$r][1] = 'Diagnose-Protokolle löschen';
|
|
$this->rights[$r][4] = 'protocol';
|
|
$this->rights[$r][5] = 'delete';
|
|
$r++;
|
|
|
|
// Top-Menü
|
|
$this->menu = array();
|
|
$r = 0;
|
|
|
|
$this->menu[$r++] = array(
|
|
'fk_menu' => '',
|
|
'type' => 'top',
|
|
'titre' => 'ModuleNetDiagName',
|
|
'prefix' => img_picto('', $this->picto, 'class="pictofixedwidth valignmiddle"'),
|
|
'mainmenu' => 'netdiag',
|
|
'leftmenu' => '',
|
|
'url' => '/custom/netdiag/netdiagindex.php',
|
|
'langs' => 'netdiag@netdiag',
|
|
'position' => 1000 + $r,
|
|
'enabled' => '0', // Top-Menü deaktiviert — Zugriff nur über Tab an Kunde/Auftrag
|
|
'perms' => '$user->hasRight("netdiag", "protocol", "read")',
|
|
'target' => '',
|
|
'user' => 2,
|
|
);
|
|
|
|
$this->menu[$r++] = array(
|
|
'fk_menu' => 'fk_mainmenu=netdiag',
|
|
'type' => 'left',
|
|
'titre' => 'NetDiagProtocolList',
|
|
'prefix' => img_picto('', $this->picto, 'class="pictofixedwidth valignmiddle paddingright"'),
|
|
'mainmenu' => 'netdiag',
|
|
'leftmenu' => 'netdiag_protocol_list',
|
|
'url' => '/custom/netdiag/netdiagindex.php',
|
|
'langs' => 'netdiag@netdiag',
|
|
'position' => 1000 + $r,
|
|
'enabled' => 'isModEnabled("netdiag")',
|
|
'perms' => '$user->hasRight("netdiag", "protocol", "read")',
|
|
'target' => '',
|
|
'user' => 2,
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Wird beim Aktivieren des Moduls aufgerufen.
|
|
* Legt Konstanten, Rechte, Menüs und Datenbanktabellen an.
|
|
*
|
|
* @param string $options Optionen ('', 'noboxes')
|
|
* @return int<-1,1> 1 wenn OK, <=0 bei Fehler
|
|
*/
|
|
public function init($options = '')
|
|
{
|
|
global $conf, $langs;
|
|
|
|
// SQL-Tabellen beim Aktivieren laden
|
|
$result = $this->_load_tables('/netdiag/sql/');
|
|
if ($result < 0) {
|
|
return -1;
|
|
}
|
|
|
|
// Rechte entfernen/neu setzen
|
|
$this->remove($options);
|
|
|
|
$sql = array();
|
|
|
|
return $this->_init($sql, $options);
|
|
}
|
|
|
|
/**
|
|
* Wird beim Deaktivieren des Moduls aufgerufen.
|
|
*
|
|
* @param string $options Optionen ('', 'noboxes')
|
|
* @return int<-1,1> 1 wenn OK, <=0 bei Fehler
|
|
*/
|
|
public function remove($options = '')
|
|
{
|
|
$sql = array();
|
|
return $this->_remove($sql, $options);
|
|
}
|
|
}
|