feat: disable/block teamer users as admin

This commit is contained in:
Björn Fromme
2025-07-22 17:11:39 +02:00
parent 0fc7684fc7
commit ea574427fb
10 changed files with 300 additions and 6 deletions
@@ -0,0 +1,19 @@
{% extends 'htmx_modal.html.twig' %}
{% block title %}Benutzeraccount sperren{% endblock %}
{% block content %}
{{ form_start(form) }}
<h2 class="font-bold text-lg pb-4">
Teamer:in {{ teamer }}
</h2>
<div class="flex flex-col space-y-4 pb-4">
{{ form_row(form.disabledReason) }}
{{ form_row(form.disabledReasonInternal) }}
</div>
<button type="submit" class="btn bg-red-500 text-white">
Sperren
</button>
{{ form_rest(form) }}
{{ form_end(form) }}
{% endblock %}
@@ -0,0 +1,10 @@
{% extends 'htmx_confirmation_modal.html.twig' %}
{% block content %}
<div class="pb-4">
Möchtest du den Benutzeraccount von <em>{{ teamer }}</em> wirklich reaktivieren?
</div>
<div>
Der Grund der Sperrung war: <em>{{ teamer.user.disabledReasonInternal ?? teamer.user.disabledReason }}</em>
</div>
{% endblock %}
@@ -5,7 +5,7 @@
{% block content %}
{{ form_start(form) }}
<h2 class="font-bold text-lg pb-4">
Teamer {{ disposition.teamer }}
Teamer:in {{ disposition.teamer }}
</h2>
<div class="flex flex-col space-y-4 pb-4">
{{ form_row(form.calledOffBy) }}
@@ -101,15 +101,44 @@
{{ icon('check') }}
</button>
{% endif %}
{% if is_granted('CAN_IMPERSONATE', teamer.user) %}
<a href="{{ path('app_teamer_index', { '_switch_user': teamer.user.email }) }}" title="Als Teamer:in maskieren">
{{ icon('mask') }}
</a>
{% if teamer.user.disabled %}
{% if is_granted('ROLE_ADMIN') %}
<button type="button"
role="menuitem"
tabindex="-1"
hx-get="{{ path('app_admin_teamer_enable_user', { 'uuid': teamer.uuid }) }}"
hx-target="body"
hx-swap="beforeend">
{{ icon('unlocked') }}
</button>
{% endif %}
{% else %}
{% if is_granted('ROLE_ADMIN') %}
<button type="button"
class="text-red-500"
role="menuitem"
tabindex="-1"
hx-get="{{ path('app_admin_teamer_disable_user', { 'uuid': teamer.uuid }) }}"
hx-target="body"
hx-swap="beforeend">
{{ icon('locked') }}
</button>
{% endif %}
{% if is_granted('CAN_IMPERSONATE', teamer.user) %}
<a href="{{ path('app_teamer_index', { '_switch_user': teamer.user.email }) }}" title="Als Teamer:in maskieren">
{{ icon('mask') }}
</a>
{% endif %}
{% endif %}
<a href="{{ path('app_administrative_teamer_profile', { 'uuid': teamer.uuid, 'r': return_url() }) }}" title="Teamer:innenprofil {{ teamer }}">
{{ icon('user') }}
</a>
</div>
{% if teamer.user.disabled %}
<div class="py-1 px-2 mt-2 text-xs bg-red-500 text-white">
gesp. am {{ teamer.user.disabledAt | date('d.m.Y') }}
</div>
{% endif %}
</td>
</tr>
{% else %}