Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions backend/config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ services:
App\Auth\Permissions:
arguments: ['%kernel.project_dir%', 'config/permissions.yaml']

App\Instrumentation\DataCollector\PermissionVoterCollector:
App\Instrumentation\DataCollector\PermissionVotesCollector:
tags:
- { name: data_collector, template: 'profiler/permission_voter_collector.html.twig', id: 'app.permission_voter_collector' }
- { name: data_collector, template: 'profiler/permission_votes.html.twig', id: 'app.permission_votes_collector' }

App\Instrumentation\DataCollector\ArchitectureCollector:
arguments:
Expand Down
4 changes: 2 additions & 2 deletions backend/src/Auth/PermissionVoter.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace App\Auth;

use App\Game\CurrentUserInterface;
use App\Instrumentation\DataCollector\PermissionVoterCollector;
use App\Instrumentation\DataCollector\PermissionVotesCollector;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\Vote;
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
Expand All @@ -17,7 +17,7 @@ final class PermissionVoter extends Voter
{
public function __construct(
private readonly CurrentUserInterface $currentUser,
private readonly PermissionVoterCollector $collector,
private readonly PermissionVotesCollector $collector,
) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\DataCollector\DataCollector;

class PermissionVoterCollector extends DataCollector
class PermissionVotesCollector extends DataCollector
{
public function addVoterCall(string $attribute, mixed $subject, bool $hasPermission): void
{
Expand Down Expand Up @@ -98,6 +98,6 @@ public function reset(): void

public function getName(): string
{
return 'app.permission_voter_collector';
return 'app.permission_votes_collector';
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{# templates/profiler/permission_voter_collector.html.twig #}
{# templates/profiler/permission_votes.html.twig #}
{% extends '@WebProfiler/Profiler/layout.html.twig' %}

{% block toolbar %}
{% set icon %}
<span class="icon">{{ include('profiler/icon.svg') }}</span>
{{ include('profiler/lock.svg') }}
<span class="sf-toolbar-value">{{ collector.voterCalls|length }}</span>
{% endset %}

{% set text %}
<div class="sf-toolbar-info-piece">
<b>Voter Calls</b>
<b>Permission votes</b>
<span>{{ collector.voterCalls|length }}</span>
</div>
{% endset %}
Expand All @@ -19,18 +19,18 @@

{% block menu %}
<span class="label">
<span class="icon">{{ include('profiler/icon.svg') }}</span>
<strong>Voter</strong>
{{ include('profiler/lock.svg') }}
<strong>Votes</strong>
<span class="count">{{ collector.voterCalls|length }}</span>
</span>
{% endblock %}

{% block panel %}
<h2>PermissionVoter Calls</h2>
<h2>Permission votes</h2>

{% if collector.voterCalls is empty %}
<div class="empty">
<p>No calls to PermissionVoter during this request.</p>
<p>No votes yet.</p>
</div>
{% else %}
<table class="alt">
Expand Down
Loading
Loading