Beide Module wurden aus einem anderen Kundenprojekt kopiert und bereinigt: Knowledgecenter: - Bild-Cache (1.985 Dateien) geleert, Ordnerstruktur mit .gitkeep behalten - Files-Gallery-Lizenzschlüssel entfernt (config.php) - Kundenspezifische Kategorien gelöscht: Teil I/II/III QM-Struktur, nummerierte QM-Kapitel, Gremien (Präsidium/Finanzausschuss/Landesausschuss), Sitzungsservice-Serie, Protokoll-Abteilungen, Testeinträge - 56 generische Kategorien bleiben (Downloads, Onboarding, Personalthemen …) Tasks: - Alle Betriebsdaten gelöscht (114 Tasks, 914 Submissions, 579 Assignments) - Task-Definitionen und Verlinkungen geleert - Kategoriestruktur bleibt (Allgemein, IT, Personal, Buchhaltung …) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
51 lines
1.8 KiB
PHP
51 lines
1.8 KiB
PHP
<?php
|
||
|
||
/**
|
||
* Zunächst: Holen der User-Daten (Mandanten, Abteilungen, Rollen)
|
||
*/
|
||
$currentUserId = $GLOBALS["main_contact"]["id"] ?? 0;
|
||
$userMandants = [];
|
||
$userDepartments = [];
|
||
$userRoles = [];
|
||
|
||
if ($currentUserId) {
|
||
$query = "SELECT main_mandant_id, main_department_id, main_role_id
|
||
FROM main_contact_link
|
||
WHERE main_contact_id = $currentUserId AND active_d = 1";
|
||
$result = mysqli_query($GLOBALS['mysql_con'], $query);
|
||
while ($row = mysqli_fetch_assoc($result)) {
|
||
// Filtere 0 aus – 0 gilt als "keine Zuordnung"
|
||
if ($row['main_mandant_id'] != 0 && !in_array($row['main_mandant_id'], $userMandants)) {
|
||
$userMandants[] = $row['main_mandant_id'];
|
||
}
|
||
if ($row['main_department_id'] != 0 && !in_array($row['main_department_id'], $userDepartments)) {
|
||
$userDepartments[] = $row['main_department_id'];
|
||
}
|
||
if ($row['main_role_id'] != 0 && !in_array($row['main_role_id'], $userRoles)) {
|
||
$userRoles[] = $row['main_role_id'];
|
||
}
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Für den LEFT JOIN-Ansatz bereiten wir die erlaubten Werte als
|
||
* kommaseparierte Strings vor.
|
||
*/
|
||
$allowedMandants = !empty($userMandants) ? implode(',', $userMandants) : 'NULL';
|
||
$allowedDepartments = !empty($userDepartments) ? implode(',', $userDepartments) : 'NULL';
|
||
$allowedRoles = !empty($userRoles) ? implode(',', $userRoles) : 'NULL';
|
||
|
||
// Für den globalen Zugriff kannst Du auch die Variablen in $GLOBALS speichern:
|
||
$GLOBALS['allowedMandants'] = $allowedMandants;
|
||
$GLOBALS['allowedDepartments'] = $allowedDepartments;
|
||
$GLOBALS['allowedRoles'] = $allowedRoles;
|
||
|
||
|
||
|
||
|
||
// echo "<pre>";
|
||
// echo "Mandanten: " . $allowedMandants . "\n";
|
||
// echo "Abteilungen: " . $allowedDepartments . "\n";
|
||
// echo "Rollen: " . $allowedRoles . "\n";
|
||
// echo "</pre>";
|