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,6 +9,7 @@
|
|||||||
<div class="pb-8">
|
<div class="pb-8">
|
||||||
{% include '_partials/_assignment_info_compact.html.twig' %}
|
{% include '_partials/_assignment_info_compact.html.twig' %}
|
||||||
</div>
|
</div>
|
||||||
|
{% if is_granted('ROLE_ADMIN') %}
|
||||||
<div class="col-span-2">
|
<div class="col-span-2">
|
||||||
<h2 class="font-bold text-lg pb-4">
|
<h2 class="font-bold text-lg pb-4">
|
||||||
Bewerbungen
|
Bewerbungen
|
||||||
@@ -103,6 +104,7 @@
|
|||||||
</table>
|
</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>
|
||||||
|
{% if is_granted('ROLE_ADMIN') %}
|
||||||
<th>
|
<th>
|
||||||
Bewerbungen
|
Bewerbungen
|
||||||
</th>
|
</th>
|
||||||
|
{% endif %}
|
||||||
<th>
|
<th>
|
||||||
Einteilungen
|
Einteilungen
|
||||||
</th>
|
</th>
|
||||||
@@ -128,11 +130,13 @@
|
|||||||
-
|
-
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
|
{% if is_granted('ROLE_ADMIN') %}
|
||||||
<td>
|
<td>
|
||||||
<a href="{{ path('app_administrative_assignment_detail', { 'uuid': assignment.uuid, 'r': return_url() }) }}" class="flex items-center space-x-2">
|
<a href="{{ path('app_administrative_assignment_detail', { 'uuid': assignment.uuid, 'r': return_url() }) }}" class="flex items-center space-x-2">
|
||||||
<span>{{ assignment.validApplications|length }}</span>
|
<span>{{ assignment.validApplications|length }}</span>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</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