This commit is contained in:
@@ -25,6 +25,10 @@ $info = '';
|
||||
$canManageApplications = $access->canManageApplications((int)$userId) && $access->supportsApplications();
|
||||
$canManageRoles = $access->canManageRoles((int)$userId);
|
||||
$canReviewListings = $listingCatalog !== null && !$access->hasRole((int)$userId, 'owner');
|
||||
$roleUserSearchQuery = trim((string)($_GET['role_user_query'] ?? ''));
|
||||
$roleUserSearchResults = ($canManageRoles || $canManageApplications) && $roleUserSearchQuery !== ''
|
||||
? $access->searchUsers($roleUserSearchQuery, 12)
|
||||
: [];
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$action = (string)($_POST['action'] ?? '');
|
||||
@@ -219,33 +223,64 @@ $migrationStatus = ($migration && $canManageApplications) ? $migration->status()
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<?php if ($canManageRoles): ?>
|
||||
<?php if ($canManageRoles || $canManageApplications): ?>
|
||||
<section class="forum-board">
|
||||
<div class="forum-board__head">
|
||||
<div>
|
||||
<h2>Rollen verwalten</h2>
|
||||
<p class="muted">Community-Rollen vergeben und entziehen.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div style="padding:24px; border-bottom:1px solid var(--color-border);">
|
||||
<form method="post" class="form-grid single">
|
||||
<input type="hidden" name="action" value="role_assign">
|
||||
<form method="get" class="form-grid single">
|
||||
<div class="stack gap-6">
|
||||
<label class="label" for="adminTargetUserId">Benutzer-ID</label>
|
||||
<input id="adminTargetUserId" name="target_user_id" class="input" type="number" min="1" required>
|
||||
</div>
|
||||
<div class="stack gap-6">
|
||||
<label class="label" for="adminRole">Rolle</label>
|
||||
<select id="adminRole" name="role" class="select">
|
||||
<option value="forum_admin">forum_admin</option>
|
||||
<option value="site_admin">site_admin</option>
|
||||
<option value="owner">owner</option>
|
||||
</select>
|
||||
<label class="label" for="adminRoleUserQuery">Benutzer suchen</label>
|
||||
<input id="adminRoleUserQuery" name="role_user_query" class="input" value="<?= htmlspecialchars($roleUserSearchQuery, ENT_QUOTES) ?>" placeholder="Name oder E-Mail">
|
||||
</div>
|
||||
<div>
|
||||
<button class="btn" type="submit">Rolle vergeben</button>
|
||||
<button class="btn" type="submit">Suchen</button>
|
||||
</div>
|
||||
</form>
|
||||
<?php if ($roleUserSearchResults): ?>
|
||||
<div class="stack gap-12" style="margin-top:18px;">
|
||||
<?php foreach ($roleUserSearchResults as $candidate): ?>
|
||||
<?php
|
||||
$candidateUserId = (int)($candidate['id'] ?? 0);
|
||||
$candidateRoles = $access->getUserRoles($candidateUserId);
|
||||
$assignableRoles = $canManageRoles ? ['forum_admin', 'site_admin', 'owner'] : ['forum_admin'];
|
||||
?>
|
||||
<div class="card" style="padding:14px;">
|
||||
<strong><?= htmlspecialchars((string)($candidate['display_name'] ?: trim(((string)($candidate['first_name'] ?? '')) . ' ' . ((string)($candidate['last_name'] ?? ''))) ?: 'Mitglied'), ENT_QUOTES) ?></strong>
|
||||
<div class="muted small" style="margin-top:6px;">
|
||||
ID: <?= $candidateUserId ?> · <?= htmlspecialchars((string)($candidate['email'] ?? ''), ENT_QUOTES) ?>
|
||||
</div>
|
||||
<?php if ($candidateRoles): ?>
|
||||
<div class="muted small" style="margin-top:6px;">Aktuelle Rollen: <?= htmlspecialchars(implode(', ', array_map('strval', $candidateRoles)), ENT_QUOTES) ?></div>
|
||||
<?php endif; ?>
|
||||
<div class="flex gap-8" style="margin-top:12px; flex-wrap:wrap;">
|
||||
<?php foreach ($assignableRoles as $roleKey): ?>
|
||||
<?php if (!in_array($roleKey, $candidateRoles, true)): ?>
|
||||
<form method="post">
|
||||
<input type="hidden" name="action" value="role_assign">
|
||||
<input type="hidden" name="target_user_id" value="<?= $candidateUserId ?>">
|
||||
<input type="hidden" name="role" value="<?= htmlspecialchars($roleKey, ENT_QUOTES) ?>">
|
||||
<button class="btn ghost" type="submit"><?= htmlspecialchars($roleKey, ENT_QUOTES) ?> vergeben</button>
|
||||
</form>
|
||||
<?php elseif ($canManageRoles): ?>
|
||||
<form method="post">
|
||||
<input type="hidden" name="action" value="role_revoke">
|
||||
<input type="hidden" name="target_user_id" value="<?= $candidateUserId ?>">
|
||||
<input type="hidden" name="role" value="<?= htmlspecialchars($roleKey, ENT_QUOTES) ?>">
|
||||
<button class="btn ghost" type="submit"><?= htmlspecialchars($roleKey, ENT_QUOTES) ?> entziehen</button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php elseif ($roleUserSearchQuery !== ''): ?>
|
||||
<p class="muted small" style="margin-top:18px;">Keine passenden Benutzer gefunden.</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="forum-admin-list">
|
||||
<?php foreach ($roleAssignments as $assignment): ?>
|
||||
|
||||
@@ -340,6 +340,64 @@ if (!empty($canManageSystemSettings)) {
|
||||
<h2>Profil-Levels</h2>
|
||||
</div>
|
||||
<div class="account-panel__body">
|
||||
<div class="card" style="margin-bottom:18px;">
|
||||
<strong>Benutzer suchen</strong>
|
||||
<form method="get" class="stack gap-12" style="margin-top:14px;">
|
||||
<input type="hidden" name="section" value="profile-levels">
|
||||
<div class="form-grid">
|
||||
<div class="stack gap-6">
|
||||
<label class="label" for="profileLevelUserQuery">Name oder E-Mail</label>
|
||||
<input id="profileLevelUserQuery" name="profile_level_user_query" class="input" value="<?= htmlspecialchars((string)($profileLevelUserSearchQuery ?? ''), ENT_QUOTES) ?>">
|
||||
</div>
|
||||
<div class="stack gap-6" style="justify-content:end;">
|
||||
<span class="label" aria-hidden="true"> </span>
|
||||
<button class="btn" type="submit">Suchen</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<?php if (!empty($profileLevelUserSearchResults)): ?>
|
||||
<div class="stack gap-12" style="margin-top:18px;">
|
||||
<?php foreach ($profileLevelUserSearchResults as $searchedUser): ?>
|
||||
<div class="card" style="padding:14px;">
|
||||
<div class="flex between center-y" style="gap:12px; flex-wrap:wrap;">
|
||||
<div>
|
||||
<strong><?= htmlspecialchars((string)($searchedUser['display_name'] ?: trim(((string)($searchedUser['first_name'] ?? '')) . ' ' . ((string)($searchedUser['last_name'] ?? ''))) ?: 'Mitglied'), ENT_QUOTES) ?></strong>
|
||||
<div class="muted small" style="margin-top:6px;">
|
||||
ID: <?= (int)($searchedUser['id'] ?? 0) ?> ·
|
||||
<?= htmlspecialchars((string)($searchedUser['email'] ?? ''), ENT_QUOTES) ?> ·
|
||||
Punkte: <?= number_format((float)($searchedUser['community_points'] ?? 0), 1, ',', '.') ?> ·
|
||||
Level: <?= htmlspecialchars(trim(((string)(($searchedUser['community_level']['icon'] ?? ''))) . ' ' . ((string)(($searchedUser['community_level']['label'] ?? '')))), ENT_QUOTES) ?>
|
||||
</div>
|
||||
<?php if (!empty($searchedUser['roles'])): ?>
|
||||
<div class="muted small" style="margin-top:6px;">System-Level: <?= htmlspecialchars(implode(', ', array_map('strval', (array)$searchedUser['roles'])), ENT_QUOTES) ?></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<form method="post" class="stack gap-12" style="margin-top:14px;">
|
||||
<input type="hidden" name="action" value="community_points_adjust">
|
||||
<input type="hidden" name="target_user_id" value="<?= (int)($searchedUser['id'] ?? 0) ?>">
|
||||
<div class="form-grid">
|
||||
<div class="stack gap-6">
|
||||
<label class="label" for="communityPointsAmount<?= (int)($searchedUser['id'] ?? 0) ?>">Punkte erhöhen</label>
|
||||
<input id="communityPointsAmount<?= (int)($searchedUser['id'] ?? 0) ?>" name="points_amount" class="input" type="number" min="0.1" step="0.1" required>
|
||||
</div>
|
||||
<div class="stack gap-6">
|
||||
<label class="label" for="communityPointsReason<?= (int)($searchedUser['id'] ?? 0) ?>">Begründung</label>
|
||||
<input id="communityPointsReason<?= (int)($searchedUser['id'] ?? 0) ?>" name="points_reason" class="input" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex gap-12" style="flex-wrap:wrap;">
|
||||
<button class="btn" type="submit">Punkte vergeben</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php elseif (($profileLevelUserSearchQuery ?? '') !== ''): ?>
|
||||
<p class="muted small" style="margin-top:14px;">Keine passenden Benutzer gefunden.</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<strong>Community-Levels</strong>
|
||||
<div class="stack gap-12" style="margin-top:14px;">
|
||||
|
||||
Reference in New Issue
Block a user