feat: limit access for role manager to assignment details
This commit is contained in:
@@ -46,14 +46,19 @@ class DispositionVoter extends Voter
|
|||||||
$disposition = $subject;
|
$disposition = $subject;
|
||||||
|
|
||||||
return match ($attribute) {
|
return match ($attribute) {
|
||||||
static::VIEW, static::EDIT, static::CONTRACT, static::INVOICE => $this->assertAdministrativeAccess($token) || $this->assertTeamerAccess($token, $disposition),
|
static::VIEW, static::EDIT, static::CONTRACT, static::INVOICE => $this->assertAdministrativeAccess() || $this->assertTeamerAccess($token, $disposition),
|
||||||
static::DELETE => $this->assertAdministrativeAccess($token),
|
static::DELETE => $this->assertAdminAccess(),
|
||||||
static::FEEDBACK => $this->assertHouseManagerAccess($token, $disposition),
|
static::FEEDBACK => $this->assertHouseManagerAccess($token, $disposition),
|
||||||
default => false,
|
default => false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private function assertAdministrativeAccess(TokenInterface $token): bool
|
private function assertAdminAccess(): bool
|
||||||
|
{
|
||||||
|
return $this->security->isGranted('ROLE_ADMIN');
|
||||||
|
}
|
||||||
|
|
||||||
|
private function assertAdministrativeAccess(): bool
|
||||||
{
|
{
|
||||||
return $this->security->isGranted('ROLE_ADMINISTRATIVE');
|
return $this->security->isGranted('ROLE_ADMINISTRATIVE');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,100 +9,102 @@
|
|||||||
<div class="pb-8">
|
<div class="pb-8">
|
||||||
{% include '_partials/_assignment_info_compact.html.twig' %}
|
{% include '_partials/_assignment_info_compact.html.twig' %}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-span-2">
|
{% if is_granted('ROLE_ADMIN') %}
|
||||||
<h2 class="font-bold text-lg pb-4">
|
<div class="col-span-2">
|
||||||
Bewerbungen
|
<h2 class="font-bold text-lg pb-4">
|
||||||
</h2>
|
Bewerbungen
|
||||||
<div class="data-table-wrapper w-full">
|
</h2>
|
||||||
<div class="data-table-wrapper__inner">
|
<div class="data-table-wrapper w-full">
|
||||||
<table class="data-table">
|
<div class="data-table-wrapper__inner">
|
||||||
<thead>
|
<table class="data-table">
|
||||||
<tr>
|
<thead>
|
||||||
<th class="w-1/4">
|
|
||||||
Name
|
|
||||||
</th>
|
|
||||||
<th class="w-1/4">
|
|
||||||
Zustieg
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
Wünsche
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
Status
|
|
||||||
</th>
|
|
||||||
<th></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for application in applications %}
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<th class="w-1/4">
|
||||||
<button type="button"
|
Name
|
||||||
class="flex items-center space-x-1"
|
</th>
|
||||||
title="Teamer:inneninfo {{ application.teamer }}"
|
<th class="w-1/4">
|
||||||
hx-get="{{ path('app_admin_application_info', { 'uuid': application.uuid }) }}"
|
Zustieg
|
||||||
hx-target="body"
|
</th>
|
||||||
hx-swap="beforeend">
|
<th>
|
||||||
<span>{{ application.teamer }}</span>
|
Wünsche
|
||||||
{{ icon('info', 'w-4 h-4') }}
|
</th>
|
||||||
</button>
|
<th>
|
||||||
{% include '_partials/_rating_stars.html.twig' with { 'teamer': application.teamer } %}
|
Status
|
||||||
</td>
|
</th>
|
||||||
<td>
|
<th></th>
|
||||||
{{ application.pickup|bpn_pickup_label|default('-') }}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{{ application.requests|nl2br|default('-') }}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{{ ('label.application.status.' ~ application.status)|trans }}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div class="flex items-center justify-end space-x-2">
|
|
||||||
{% if is_granted('DISPOSE', application) %}
|
|
||||||
<button type="button"
|
|
||||||
class="text-green-500"
|
|
||||||
title="einteilen"
|
|
||||||
hx-get="{{ path('app_admin_application_dispose', { 'uuid': application.uuid }) }}"
|
|
||||||
hx-target="body"
|
|
||||||
hx-swap="beforeend">
|
|
||||||
{{ icon('check') }}
|
|
||||||
</button>
|
|
||||||
{% endif %}
|
|
||||||
{% if is_granted('STATUS', application) %}
|
|
||||||
<button type="button"
|
|
||||||
class="text-primary"
|
|
||||||
title="Bewerbungsstatus bearbeiten"
|
|
||||||
hx-get="{{ path('app_admin_application_status', { 'uuid': application.uuid }) }}"
|
|
||||||
hx-target="body"
|
|
||||||
hx-swap="beforeend">
|
|
||||||
{{ icon('power') }}
|
|
||||||
</button>
|
|
||||||
{% endif %}
|
|
||||||
{% if is_granted('DELETE', application) %}
|
|
||||||
<button type="button"
|
|
||||||
class="text-red-500"
|
|
||||||
title="Bewerbung löschen"
|
|
||||||
hx-get="{{ path('app_admin_application_delete', { 'uuid': application.uuid }) }}"
|
|
||||||
hx-target="body"
|
|
||||||
hx-swap="beforeend">
|
|
||||||
{{ icon('delete') }}
|
|
||||||
</button>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
{% else %}
|
</thead>
|
||||||
<tr>
|
<tbody>
|
||||||
<td colspan="4">
|
{% for application in applications %}
|
||||||
Es liegen keine Bewerbungen vor...
|
<tr>
|
||||||
</td>
|
<td>
|
||||||
</tr>
|
<button type="button"
|
||||||
{% endfor %}
|
class="flex items-center space-x-1"
|
||||||
</tbody>
|
title="Teamer:inneninfo {{ application.teamer }}"
|
||||||
</table>
|
hx-get="{{ path('app_admin_application_info', { 'uuid': application.uuid }) }}"
|
||||||
|
hx-target="body"
|
||||||
|
hx-swap="beforeend">
|
||||||
|
<span>{{ application.teamer }}</span>
|
||||||
|
{{ icon('info', 'w-4 h-4') }}
|
||||||
|
</button>
|
||||||
|
{% include '_partials/_rating_stars.html.twig' with { 'teamer': application.teamer } %}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ application.pickup|bpn_pickup_label|default('-') }}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ application.requests|nl2br|default('-') }}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ ('label.application.status.' ~ application.status)|trans }}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div class="flex items-center justify-end space-x-2">
|
||||||
|
{% if is_granted('DISPOSE', application) %}
|
||||||
|
<button type="button"
|
||||||
|
class="text-green-500"
|
||||||
|
title="einteilen"
|
||||||
|
hx-get="{{ path('app_admin_application_dispose', { 'uuid': application.uuid }) }}"
|
||||||
|
hx-target="body"
|
||||||
|
hx-swap="beforeend">
|
||||||
|
{{ icon('check') }}
|
||||||
|
</button>
|
||||||
|
{% endif %}
|
||||||
|
{% if is_granted('STATUS', application) %}
|
||||||
|
<button type="button"
|
||||||
|
class="text-primary"
|
||||||
|
title="Bewerbungsstatus bearbeiten"
|
||||||
|
hx-get="{{ path('app_admin_application_status', { 'uuid': application.uuid }) }}"
|
||||||
|
hx-target="body"
|
||||||
|
hx-swap="beforeend">
|
||||||
|
{{ icon('power') }}
|
||||||
|
</button>
|
||||||
|
{% endif %}
|
||||||
|
{% if is_granted('DELETE', application) %}
|
||||||
|
<button type="button"
|
||||||
|
class="text-red-500"
|
||||||
|
title="Bewerbung löschen"
|
||||||
|
hx-get="{{ path('app_admin_application_delete', { 'uuid': application.uuid }) }}"
|
||||||
|
hx-target="body"
|
||||||
|
hx-swap="beforeend">
|
||||||
|
{{ icon('delete') }}
|
||||||
|
</button>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% else %}
|
||||||
|
<tr>
|
||||||
|
<td colspan="4">
|
||||||
|
Es liegen keine Bewerbungen vor...
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{% endif %}
|
||||||
<h2 class="font-bold text-lg pb-4">
|
<h2 class="font-bold text-lg pb-4">
|
||||||
Einteilungen
|
Einteilungen
|
||||||
</h2>
|
</h2>
|
||||||
|
|||||||
@@ -49,9 +49,11 @@
|
|||||||
<th>
|
<th>
|
||||||
{{ knp_pagination_sortable(pagination, 'Bus', 'assignment.pickup') }}
|
{{ knp_pagination_sortable(pagination, 'Bus', 'assignment.pickup') }}
|
||||||
</th>
|
</th>
|
||||||
<th>
|
{% if is_granted('ROLE_ADMIN') %}
|
||||||
Bewerbungen
|
<th>
|
||||||
</th>
|
Bewerbungen
|
||||||
|
</th>
|
||||||
|
{% endif %}
|
||||||
<th>
|
<th>
|
||||||
Einteilungen
|
Einteilungen
|
||||||
</th>
|
</th>
|
||||||
@@ -128,11 +130,13 @@
|
|||||||
-
|
-
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
{% if is_granted('ROLE_ADMIN') %}
|
||||||
<a href="{{ path('app_administrative_assignment_detail', { 'uuid': assignment.uuid, 'r': return_url() }) }}" class="flex items-center space-x-2">
|
<td>
|
||||||
<span>{{ assignment.validApplications|length }}</span>
|
<a href="{{ path('app_administrative_assignment_detail', { 'uuid': assignment.uuid, 'r': return_url() }) }}" class="flex items-center space-x-2">
|
||||||
</a>
|
<span>{{ assignment.validApplications|length }}</span>
|
||||||
</td>
|
</a>
|
||||||
|
</td>
|
||||||
|
{% endif %}
|
||||||
<td>
|
<td>
|
||||||
<span>{{ assignment.dispositions|length }}/{{ assignment.availableDispositions }}</span>
|
<span>{{ assignment.dispositions|length }}/{{ assignment.availableDispositions }}</span>
|
||||||
<ul>
|
<ul>
|
||||||
|
|||||||
Reference in New Issue
Block a user