diff --git a/partials/landing/account/dashboard.php b/partials/landing/account/dashboard.php index 219ccc4..4a67aaf 100755 --- a/partials/landing/account/dashboard.php +++ b/partials/landing/account/dashboard.php @@ -13,9 +13,6 @@ $sectionLinks = [ 'community' => 'Community', 'settings' => 'Einstellungen', ]; -if (in_array('admin', $allowedSections ?? [], true)) { - $sectionLinks['admin'] = 'Admin'; -} ?>
@@ -277,33 +274,6 @@ if (in_array('admin', $allowedSections ?? [], true)) { - - -
diff --git a/partials/structure/nav.php b/partials/structure/nav.php index 9b40517..68a04ca 100755 --- a/partials/structure/nav.php +++ b/partials/structure/nav.php @@ -3,6 +3,7 @@ $app = app(); $isLoggedIn = isset($_SESSION['user_id']); $displayName = 'Profil'; $profileInitial = 'P'; +$showAdminLink = false; if ($isLoggedIn) { try { @@ -16,10 +17,18 @@ if ($isLoggedIn) { if ($firstChar !== '') { $profileInitial = mb_strtoupper($firstChar); } + + $communityCfg = dirname(__DIR__, 2) . '/config/community.php'; + if (file_exists($communityCfg)) { + $communityConfig = require $communityCfg; + $communityAccess = new \App\CommunityAccess($pdo, $communityConfig); + $showAdminLink = $communityAccess->canModerateForum((int)$_SESSION['user_id']); + } } } catch (\Throwable) { $displayName = 'Profil'; $profileInitial = 'P'; + $showAdminLink = false; } } ?> @@ -50,6 +59,9 @@ if ($isLoggedIn) { Termine Community Einstellungen + + Admin + Abmelden @@ -70,6 +82,9 @@ if ($isLoggedIn) { Termine Community Einstellungen + + Admin + Abmelden Anmelden diff --git a/src/App/AccountPages.php b/src/App/AccountPages.php index 8fc109b..253cab0 100755 --- a/src/App/AccountPages.php +++ b/src/App/AccountPages.php @@ -314,12 +314,6 @@ final class AccountPages } $communityAccess->submitApplication($userId, (string)($_POST['motivation'] ?? '')); $info = 'Deine Bewerbung wurde eingereicht.'; - } elseif ($action === 'community_migrate') { - if (!$communityAccess || !$communityMigration || !$communityAccess->canManageApplications($userId)) { - throw new \RuntimeException('Keine Berechtigung für die Community-Migration.'); - } - $communityMigration->apply(); - $info = 'Die Community-Migration wurde ausgeführt.'; } } catch (\Throwable $e) { $error = $e->getMessage(); @@ -405,11 +399,6 @@ final class AccountPages 'reply_blocked' => false, 'reason' => null, ]; - $communityIsSiteAdmin = $communityAccess ? $communityAccess->canManageApplications($userId) : false; - $communityMigrationStatus = ($communityMigration && $communityIsSiteAdmin) ? $communityMigration->status() : null; - if (in_array('forum_admin', $communityRoles, true) || $communityIsSiteAdmin) { - $allowedSections[] = 'admin'; - } if (!in_array($section, $allowedSections, true)) { $section = 'profile'; } @@ -429,8 +418,6 @@ final class AccountPages 'communityApplication', 'communityCanApply', 'communityRestrictions', - 'communityIsSiteAdmin', - 'communityMigrationStatus', 'section', 'allowedSections' );