drink-it-cold/views/admin_users.php
torsten 0a2d0a879d Benutzer per Einladungslink Zugang geben
- Einladung per E-Mail oder als Link zum Weitergeben: 7 Tage gültig,
  einmalig, Token nur als SHA-256-Hash gespeichert
- Seite /invite/<token>, auf der der Benutzer sein Passwort selbst setzt
- Admin kann jederzeit eine neue Einladung erzeugen; altes Passwort und
  bestehende Sitzungen werden dabei ungültig
- Migration 005_user_invites, Aufräumen im Cron, Datenschutzerklärung ergänzt
- deploy.sh: liest credentials.txt im Format KEY: value, nutzt TLS 1.2 für den
  FTP-Datenkanal (KAS bricht bei TLS 1.3 ab ~16 KB mit 426 ab) und übernimmt
  VAPID-Schlüssel, Cron-Token und Mail-Einstellungen aus der Live-Konfiguration
2026-11-18 22:20:37 +01:00

92 lines
4.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/** @var array $users */
/** @var array $pushCounts */
/** @var array $pushLastUpdate */
/** @var bool $pushConfigured */
/** @var array $openInvites */
?>
<div class="page-head page-head--compact">
<div>
<p class="eyebrow">Verwaltung</p>
<h1>Benutzer</h1>
<p class="page-head__lede">Zugänge werden ausschließlich hier angelegt – eine Selbstregistrierung gibt es nicht.</p>
</div>
<div class="page-head__actions">
<a class="btn primary" href="<?= e(url('/admin/users/new')) ?>"><svg class="ico" aria-hidden="true"><use href="#i-plus"/></svg> Benutzer anlegen</a>
</div>
</div>
<?php require __DIR__ . '/_admin_nav.php'; ?>
<section class="panel">
<div class="panel__head">
<div>
<h2><?= count($users) ?> Benutzerkonto<?= count($users) === 1 ? '' : 'en' ?></h2>
<p>Angemeldet wird mit Vorname, Nachname und Passwort.</p>
</div>
</div>
<div class="table-wrap">
<table class="data-table">
<thead>
<tr>
<th>Name</th>
<th>Rolle</th>
<th>Mitarbeiterkonto</th>
<th>Status</th>
<th>App-Erinnerungen</th>
<th>Letzte Anmeldung</th>
<th class="ta-right">Aktionen</th>
</tr>
</thead>
<tbody>
<?php foreach ($users as $row): ?>
<tr>
<td>
<span class="table-person">
<span class="avatar avatar--small"><?= e(initials($row['first_name'] . ' ' . $row['last_name'])) ?></span>
<span><strong><?= e($row['first_name'] . ' ' . $row['last_name']) ?></strong>
<small><?= e($row['email'] ?: 'keine E-Mail hinterlegt') ?></small>
<?php if (isset($openInvites[(int) $row['id']])): ?>
<small class="invite-open">Einladung offen bis <?= e(fmt_datetime($openInvites[(int) $row['id']])) ?></small>
<?php endif; ?>
</span>
</span>
</td>
<td><span class="pill <?= $row['role'] === 'admin' ? 'pill--blue' : 'pill--grey' ?>"><?= $row['role'] === 'admin' ? 'Administrator' : 'Mitarbeiter' ?></span></td>
<td><?= e($row['employee_name'] ?: '–') ?></td>
<td><span class="pill <?= $row['status'] === 'active' ? 'pill--green' : 'pill--red' ?>"><?= $row['status'] === 'active' ? 'aktiv' : 'deaktiviert' ?></span></td>
<td>
<?php $devices = (int) ($pushCounts[(int) $row['id']] ?? 0); ?>
<?php if ($devices > 0): ?>
<span class="pill pill--green" title="Zuletzt aktualisiert: <?= e(fmt_datetime($pushLastUpdate[(int) $row['id']] ?? null)) ?>">
<svg class="ico" aria-hidden="true"><use href="#i-bell"/></svg>
<?= $devices ?> Gerät<?= $devices === 1 ? '' : 'e' ?>
</span>
<?php elseif ($pushConfigured): ?>
<span class="muted small">nicht aktiviert</span>
<?php else: ?>
<span class="muted small">–</span>
<?php endif; ?>
</td>
<td><?= e(fmt_datetime($row['last_login_at'])) ?></td>
<td class="ta-right">
<a class="btn small" href="<?= e(url('/admin/users/' . (int) $row['id'])) ?>"><svg class="ico" aria-hidden="true"><use href="#i-edit"/></svg> Bearbeiten</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</section>
<div class="info-grid">
<section class="card card--note">
<h2>So funktioniert die Anmeldung</h2>
<p>Benutzer melden sich mit <strong>Vorname</strong>, <strong>Nachname</strong> und <strong>Passwort</strong> an. Namen sind eindeutig; ein Benutzer kann nur vom Administrator angelegt, geändert oder deaktiviert werden.</p>
</section>
<section class="card card--note">
<h2>Erinnerungen zuordnen</h2>
<p>Verknüpfen Sie einen Benutzer mit einem Mitarbeiterkonto, damit er nur die für ihn relevanten Erinnerungen und Aufgaben sieht. Administratoren sehen alle Erinnerungen.</p>
</section>
</div>