From 75590aab51edc04d70bc8a9b003c33e47f543ac9 Mon Sep 17 00:00:00 2001 From: Wouter de Jong Date: Sun, 27 Jun 2021 17:53:50 +0200 Subject: [PATCH] [SecurityBundle] Hide Security item if no firewall matched --- .../views/Collector/security.html.twig | 130 +++++++++--------- 1 file changed, 66 insertions(+), 64 deletions(-) diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/security.html.twig b/src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/security.html.twig index 910f4a702071..ae08da416883 100644 --- a/src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/security.html.twig +++ b/src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/security.html.twig @@ -3,85 +3,87 @@ {% block page_title 'Security' %} {% block toolbar %} - {% if collector.token %} - {% set is_authenticated = collector.enabled and collector.authenticated %} - {% set color_code = is_authenticated ? '' : 'yellow' %} - {% elseif collector.enabled %} - {% set color_code = collector.authenticatorManagerEnabled ? 'yellow' : 'red' %} - {% else %} - {% set color_code = '' %} - {% endif %} - - {% set icon %} - {{ include('@Security/Collector/icon.svg') }} - {{ collector.user|default('n/a') }} - {% endset %} - - {% set text %} - {% if collector.impersonated %} -
-
- Impersonator - {{ collector.impersonatorUser }} -
-
+ {% if not collector.firewall %} + {% if collector.token %} + {% set is_authenticated = collector.enabled and collector.authenticated %} + {% set color_code = is_authenticated ? '' : 'yellow' %} + {% elseif collector.enabled %} + {% set color_code = collector.authenticatorManagerEnabled ? 'yellow' : 'red' %} + {% else %} + {% set color_code = '' %} {% endif %} -
- {% if collector.enabled %} - {% if collector.token %} -
- Logged in as - {{ collector.user }} -
+ {% set icon %} + {{ include('@Security/Collector/icon.svg') }} + {{ collector.user|default('n/a') }} + {% endset %} + {% set text %} + {% if collector.impersonated %} +
- Authenticated - {{ is_authenticated ? 'Yes' : 'No' }} + Impersonator + {{ collector.impersonatorUser }}
+
+ {% endif %} -
- Token class - {{ collector.tokenClass|abbr_class }} -
- {% else %} -
- Authenticated - No -
- {% endif %} +
+ {% if collector.enabled %} + {% if collector.token %} +
+ Logged in as + {{ collector.user }} +
+ +
+ Authenticated + {{ is_authenticated ? 'Yes' : 'No' }} +
+ +
+ Token class + {{ collector.tokenClass|abbr_class }} +
+ {% else %} +
+ Authenticated + No +
+ {% endif %} - {% if collector.firewall %} -
- Firewall name - {{ collector.firewall.name }} -
- {% endif %} + {% if collector.firewall %} +
+ Firewall name + {{ collector.firewall.name }} +
+ {% endif %} - {% if collector.token and collector.logoutUrl %} + {% if collector.token and collector.logoutUrl %} +
+ Actions + + Logout + {% if collector.impersonated and collector.impersonationExitPath %} + | Exit impersonation + {% endif %} + +
+ {% endif %} + {% else %}
- Actions - - Logout - {% if collector.impersonated and collector.impersonationExitPath %} - | Exit impersonation - {% endif %} - + The security is disabled.
{% endif %} - {% else %} -
- The security is disabled. -
- {% endif %} -
- {% endset %} +
+ {% endset %} - {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url, status: color_code }) }} + {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url, status: color_code }) }} + {% endif %} {% endblock %} {% block menu %} - + {{ include('@Security/Collector/icon.svg') }} Security