Admin: pro-Nutzer-Rechte für Suchlauf-Start und Zeitplan
- Neue users-Spalten darf_suchlauf_starten / darf_zeitplan_aendern (Default 0 = deaktiviert); idempotente ALTER-Migration für Bestands-DBs. - Admin-Detailseite: zwei Toggles (Erlaubt/Gesperrt) je Nutzer. - /jobsuche: ohne Recht ist „Jetzt suchen" ausgeblendet und der Zeitplan (aktiv/Tage/Uhrzeit) read-only; Speichern und manueller Start sind serverseitig abgesichert. Admin (fremd) ist nie beschränkt. - Default-Zeitplan bleibt Mo–Fr 17:00 (suchprofil-Defaults). Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -66,6 +66,42 @@
|
||||
|
||||
<hr class="border-gray-100 dark:border-gray-700">
|
||||
|
||||
<!-- Suchläufe starten -->
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<div>
|
||||
<p class="text-sm font-medium text-gray-800 dark:text-gray-100">Suchläufe selber starten</p>
|
||||
<p class="text-xs text-gray-500 dark:text-gray-400">Manueller „Jetzt suchen"-Knopf auf der Jobsuche. Der automatische Zeitplan läuft davon unberührt.</p>
|
||||
</div>
|
||||
<form method="POST" action="/admin/users/<%= user.id %>/toggle-suchlauf" class="inline">
|
||||
<button type="submit"
|
||||
class="inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-md transition-colors
|
||||
<%= user.darf_suchlauf_starten ? 'bg-green-600 hover:bg-green-700 text-white' : 'bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-200 hover:bg-gray-200 dark:hover:bg-gray-600' %>">
|
||||
<span class="inline-block w-2 h-2 rounded-full <%= user.darf_suchlauf_starten ? 'bg-white' : 'bg-gray-400' %>"></span>
|
||||
<%= user.darf_suchlauf_starten ? 'Erlaubt' : 'Gesperrt' %>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<hr class="border-gray-100 dark:border-gray-700">
|
||||
|
||||
<!-- Zeitplan ändern -->
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<div>
|
||||
<p class="text-sm font-medium text-gray-800 dark:text-gray-100">Zeitplan ändern dürfen</p>
|
||||
<p class="text-xs text-gray-500 dark:text-gray-400">Wochentage, Uhrzeit und „aktiv". Standard: Mo–Fr 17:00, verwaltet vom Administrator.</p>
|
||||
</div>
|
||||
<form method="POST" action="/admin/users/<%= user.id %>/toggle-zeitplan" class="inline">
|
||||
<button type="submit"
|
||||
class="inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-md transition-colors
|
||||
<%= user.darf_zeitplan_aendern ? 'bg-green-600 hover:bg-green-700 text-white' : 'bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-200 hover:bg-gray-200 dark:hover:bg-gray-600' %>">
|
||||
<span class="inline-block w-2 h-2 rounded-full <%= user.darf_zeitplan_aendern ? 'bg-white' : 'bg-gray-400' %>"></span>
|
||||
<%= user.darf_zeitplan_aendern ? 'Erlaubt' : 'Gesperrt' %>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<hr class="border-gray-100 dark:border-gray-700">
|
||||
|
||||
<!-- Passwort zurücksetzen -->
|
||||
<div>
|
||||
<div class="flex flex-wrap items-center justify-between gap-3 mb-2">
|
||||
|
||||
+18
-4
@@ -64,10 +64,16 @@
|
||||
</div>
|
||||
<label class="inline-flex items-center gap-2 shrink-0">
|
||||
<input type="checkbox" name="aktiv" value="1" <%= profil.aktiv ? 'checked' : '' %>
|
||||
class="rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500">
|
||||
<%= !darfZeitplanAendern ? 'disabled' : '' %>
|
||||
class="rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500 disabled:opacity-60">
|
||||
<span class="text-sm text-gray-700 dark:text-gray-300">aktiv</span>
|
||||
</label>
|
||||
</div>
|
||||
<% if (!darfZeitplanAendern) { %>
|
||||
<p class="text-xs text-amber-700 dark:text-amber-300 mt-3">
|
||||
Der Zeitplan (aktiv, Wochentage, Uhrzeit) wird vom Administrator verwaltet.
|
||||
</p>
|
||||
<% } %>
|
||||
</section>
|
||||
|
||||
<section class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-6">
|
||||
@@ -162,10 +168,11 @@
|
||||
|
||||
<div class="flex flex-wrap gap-2 mb-5">
|
||||
<% wochentage.forEach(function (t) { %>
|
||||
<label class="inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md border border-gray-300 dark:border-gray-600 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700/40">
|
||||
<label class="inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md border border-gray-300 dark:border-gray-600 text-sm <%= darfZeitplanAendern ? 'cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700/40' : 'opacity-70 cursor-not-allowed' %>">
|
||||
<input type="checkbox" name="tage" value="<%= t.nr %>"
|
||||
<%= profil.zeitplan_tage.indexOf(t.nr) !== -1 ? 'checked' : '' %>
|
||||
class="rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500">
|
||||
<%= !darfZeitplanAendern ? 'disabled' : '' %>
|
||||
class="rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500 disabled:opacity-60">
|
||||
<span class="text-gray-700 dark:text-gray-300"><%= t.kurz %></span>
|
||||
</label>
|
||||
<% }); %>
|
||||
@@ -173,7 +180,8 @@
|
||||
|
||||
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1" for="zeitplan_zeit">Uhrzeit</label>
|
||||
<input type="time" id="zeitplan_zeit" name="zeitplan_zeit" value="<%= profil.zeitplan_zeit %>"
|
||||
class="rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 px-3 py-2 text-sm">
|
||||
<%= !darfZeitplanAendern ? 'disabled' : '' %>
|
||||
class="rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 px-3 py-2 text-sm disabled:opacity-60">
|
||||
<p class="text-xs text-gray-400 dark:text-gray-500 mt-1">
|
||||
Der Lauf startet innerhalb weniger Minuten nach dieser Uhrzeit.
|
||||
</p>
|
||||
@@ -203,6 +211,7 @@
|
||||
<a href="/jobangebote" class="text-blue-600 dark:text-blue-400 hover:underline">Jobangebote</a> an.
|
||||
</p>
|
||||
</div>
|
||||
<% if (darfSuchlaufStarten) { %>
|
||||
<form action="/jobsuche/start" method="POST" class="shrink-0">
|
||||
<% if (fremd) { %><input type="hidden" name="ziel_user" value="<%= zielUser.id %>"><% } %>
|
||||
<button type="submit"
|
||||
@@ -213,6 +222,11 @@
|
||||
Jetzt suchen
|
||||
</button>
|
||||
</form>
|
||||
<% } else if (!fremd) { %>
|
||||
<p class="text-xs text-gray-400 dark:text-gray-500 shrink-0 text-right max-w-[12rem]">
|
||||
Manuelle Suchläufe werden vom Administrator verwaltet.
|
||||
</p>
|
||||
<% } %>
|
||||
</div>
|
||||
|
||||
<div id="laeufe">
|
||||
|
||||
Reference in New Issue
Block a user