This commit is contained in:
@@ -184,7 +184,9 @@ final class AccountPages
|
||||
$communityPointsForAccess = $community ? $community->computePoints($userId) : 0.0;
|
||||
$canManageCategories = $communityAccess ? $communityAccess->canManageCategories($userId, $communityPointsForAccess) : false;
|
||||
$canReviewListings = $communityAccess ? $communityAccess->canReviewListings($userId, $communityPointsForAccess) : false;
|
||||
$canModerateForum = $communityAccess ? $communityAccess->canModerateForum($userId) : false;
|
||||
$canAccessCommunityAdmin = $communityAccess ? $communityAccess->canAccessCommunityAdmin($userId, $communityPointsForAccess) : false;
|
||||
$canManageUserManagement = $canManageProfileLevels || $canManageSystemSettings;
|
||||
$canAccessAdminArea = $canAccessCommunityAdmin || $canManageCategories || $canManageSystemSettings || $canManageProfileLevels;
|
||||
|
||||
// Alte Deep Links zu Verwaltungssektionen bleiben gültig, landen aber im getrennten Admin-Bereich.
|
||||
@@ -211,6 +213,15 @@ final class AccountPages
|
||||
if ($area === 'admin' && $canManageProfileLevels) {
|
||||
$allowedSections[] = 'profile-levels';
|
||||
}
|
||||
if ($area === 'admin' && $canReviewListings) {
|
||||
$allowedSections[] = 'listing-review';
|
||||
}
|
||||
if ($area === 'admin' && ($canModerateForum || $canManageSystemSettings)) {
|
||||
$allowedSections[] = 'community-moderation';
|
||||
}
|
||||
if ($area === 'admin' && $canManageUserManagement) {
|
||||
$allowedSections[] = 'user-management';
|
||||
}
|
||||
|
||||
if ($systemSettings) {
|
||||
$systemSettings->ensureSchema();
|
||||
@@ -705,6 +716,42 @@ final class AccountPages
|
||||
}
|
||||
$communityAccess->submitApplication($userId, (string)($_POST['motivation'] ?? ''));
|
||||
$info = 'Deine Bewerbung wurde eingereicht.';
|
||||
} elseif ($action === 'listing_request_decide') {
|
||||
if (!$canReviewListings || !$listingCatalog) {
|
||||
throw new \RuntimeException('Keine Berechtigung für Listing-Freigaben.');
|
||||
}
|
||||
$listingCatalog->decideModerationRequest($userId, (int)($_POST['request_id'] ?? 0), (string)($_POST['decision'] ?? ''), (string)($_POST['review_note'] ?? ''));
|
||||
$info = 'Ort oder Veranstaltung wurde bearbeitet.';
|
||||
} elseif ($action === 'application_decide') {
|
||||
if (!$canManageSystemSettings || !$communityAccess) {
|
||||
throw new \RuntimeException('Keine Berechtigung für Bewerbungen.');
|
||||
}
|
||||
$communityAccess->decideApplication($userId, (int)($_POST['application_id'] ?? 0), (string)($_POST['decision'] ?? ''), (string)($_POST['decision_reason'] ?? ''));
|
||||
$info = 'Bewerbung wurde bearbeitet.';
|
||||
} elseif ($action === 'report_resolve') {
|
||||
if (!$canModerateForum || !$communityAccess) {
|
||||
throw new \RuntimeException('Keine Berechtigung für Meldungen.');
|
||||
}
|
||||
$communityAccess->resolveReport($userId, (int)($_POST['report_id'] ?? 0), (string)($_POST['moderator_note'] ?? ''));
|
||||
$info = 'Meldung wurde abgeschlossen.';
|
||||
} elseif ($action === 'role_assign') {
|
||||
if (!$canManageUserManagement || !$communityAccess) {
|
||||
throw new \RuntimeException('Keine Berechtigung für die Benutzerverwaltung.');
|
||||
}
|
||||
$communityAccess->assignRole($userId, (int)($_POST['target_user_id'] ?? 0), (string)($_POST['role'] ?? ''));
|
||||
$info = 'Rolle wurde vergeben.';
|
||||
} elseif ($action === 'role_revoke') {
|
||||
if (!$canManageUserManagement || !$communityAccess) {
|
||||
throw new \RuntimeException('Keine Berechtigung für die Benutzerverwaltung.');
|
||||
}
|
||||
$communityAccess->revokeRole($userId, (int)($_POST['target_user_id'] ?? 0), (string)($_POST['role'] ?? ''));
|
||||
$info = 'Rolle wurde entzogen.';
|
||||
} elseif ($action === 'community_migrate') {
|
||||
if (!$canManageSystemSettings || !$communityMigration) {
|
||||
throw new \RuntimeException('Keine Berechtigung für die Community-Migration.');
|
||||
}
|
||||
$communityMigration->apply();
|
||||
$info = 'Die Community-Migration wurde ausgeführt.';
|
||||
} elseif ($action === 'community_level_save') {
|
||||
if (!$canManageProfileLevels || !$community) {
|
||||
throw new \RuntimeException('Keine Berechtigung für Profil-Levels.');
|
||||
@@ -1010,7 +1057,17 @@ final class AccountPages
|
||||
$communityLevelDefinitions = $community ? $community->listMembershipLevels() : [];
|
||||
$communityLevelRightDefinitions = Community::membershipRightDefinitions();
|
||||
$communityRoles = $communityAccess ? $communityAccess->getUserRoles($userId) : [];
|
||||
$systemRoleAssignments = $communityAccess && $canManageProfileLevels ? $communityAccess->listRoleAssignments() : [];
|
||||
$systemRoleAssignments = $communityAccess && $canManageUserManagement ? $communityAccess->listRoleAssignments() : [];
|
||||
$listingReviewRequests = $canReviewListings && $listingCatalog
|
||||
? array_values(array_filter($listingCatalog->listOpenModerationRequests(), static fn(array $request): bool => (string)($request['request_type'] ?? '') === 'create'))
|
||||
: [];
|
||||
$communityApplications = $canManageSystemSettings && $communityAccess ? $communityAccess->listApplications('open') : [];
|
||||
$communityReports = $canModerateForum && $communityAccess && $communityAccess->supportsReports() ? $communityAccess->listOpenReports() : [];
|
||||
$userManagementSearchQuery = trim((string)($_GET['user_management_query'] ?? ''));
|
||||
$userManagementSearchResults = $canManageUserManagement && $communityAccess && $userManagementSearchQuery !== ''
|
||||
? $communityAccess->searchUsers($userManagementSearchQuery, 12)
|
||||
: [];
|
||||
$communityMigrationStatus = $communityMigration && $canManageSystemSettings ? $communityMigration->status() : null;
|
||||
$recentHighLevelUsers = [];
|
||||
$recentHighLevelThresholdLabel = '';
|
||||
$profileLevelUserSearchQuery = '';
|
||||
@@ -1122,9 +1179,17 @@ final class AccountPages
|
||||
'communityLevelRightDefinitions',
|
||||
'communityRoles',
|
||||
'canReviewListings',
|
||||
'canModerateForum',
|
||||
'canAccessCommunityAdmin',
|
||||
'canAccessAdminArea',
|
||||
'canManageUserManagement',
|
||||
'systemRoleAssignments',
|
||||
'listingReviewRequests',
|
||||
'communityApplications',
|
||||
'communityReports',
|
||||
'userManagementSearchQuery',
|
||||
'userManagementSearchResults',
|
||||
'communityMigrationStatus',
|
||||
'recentHighLevelUsers',
|
||||
'recentHighLevelThresholdLabel',
|
||||
'profileLevelUserSearchQuery',
|
||||
|
||||
Reference in New Issue
Block a user