From 07a36f447ee2d602cbfd5b488908bd7516269bf2 Mon Sep 17 00:00:00 2001 From: Eduard Wisch Date: Wed, 8 Apr 2026 15:49:18 +0200 Subject: [PATCH] fix: Permission-Format korrigiert nach Stundenzettel-Vorbild MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Echter Bug: $this->rights[$r][4] muss der perms-Name sein (z.B. 'read'), NICHT der Modulname. Mit [4]='bericht'/[5]='read' baute Dolibarr den Pfad $user->rights->bericht->bericht->read — aber hasRight('bericht','read') prüft $user->rights->bericht->read → false → Tab versteckt. Korrektes Format wie Stundenzettel: [4] = 'read' / 'write' / 'delete' / 'admin' (perms) [5] = '' (subperms, leer) Außerdem [3]=1 (bydefault) für die Standard-Rechte, damit sie bei Aktivierung automatisch allen Usern zugewiesen werden. Co-Authored-By: Claude Opus 4.6 (1M context) [deploy] --- core/modules/modBericht.class.php | 34 +++++++++++++++++++------------ 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/core/modules/modBericht.class.php b/core/modules/modBericht.class.php index b08ce23..c334619 100644 --- a/core/modules/modBericht.class.php +++ b/core/modules/modBericht.class.php @@ -89,28 +89,36 @@ class modBericht extends DolibarrModules $this->boxes = array(); $this->cronjobs = array(); - // Rechte + // Rechte — wie Stundenzettel: [4]=perms, [5]=subperms (leer) $this->rights = array(); $r = 0; - $this->rights[$r][0] = $this->numero . '01'; + + $this->rights[$r][0] = $this->numero + $r; $this->rights[$r][1] = 'Berichte lesen'; - $this->rights[$r][4] = 'bericht'; - $this->rights[$r][5] = 'read'; + $this->rights[$r][3] = 1; // Standard aktiviert + $this->rights[$r][4] = 'read'; + $this->rights[$r][5] = ''; $r++; - $this->rights[$r][0] = $this->numero . '02'; + + $this->rights[$r][0] = $this->numero + $r; $this->rights[$r][1] = 'Berichte erstellen und bearbeiten'; - $this->rights[$r][4] = 'bericht'; - $this->rights[$r][5] = 'write'; + $this->rights[$r][3] = 1; + $this->rights[$r][4] = 'write'; + $this->rights[$r][5] = ''; $r++; - $this->rights[$r][0] = $this->numero . '03'; + + $this->rights[$r][0] = $this->numero + $r; $this->rights[$r][1] = 'Berichte löschen'; - $this->rights[$r][4] = 'bericht'; - $this->rights[$r][5] = 'delete'; + $this->rights[$r][3] = 1; + $this->rights[$r][4] = 'delete'; + $this->rights[$r][5] = ''; $r++; - $this->rights[$r][0] = $this->numero . '04'; + + $this->rights[$r][0] = $this->numero + $r; $this->rights[$r][1] = 'Modul Bericht administrieren (Templates verwalten)'; - $this->rights[$r][4] = 'bericht'; - $this->rights[$r][5] = 'admin'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'admin'; + $this->rights[$r][5] = ''; $r++; $this->menu = array();