{% extends 'WebProfilerBundle:Profiler:layout.html.twig' %}

{% block toolbar %}
    {% set icon %}
        <img width="24" height="28" alt="Security" style="border-width: 0; vertical-align: middle; margin-right: 5px;" src="data:image/png;base64,[encoded data, 4972 characters]" />
    {% endset %}
    {% set text %}
        {% if collector.user %}
            {{ collector.user }} {% if not collector.authenticated %}<em>(not auth.)</em>{% endif %}
        {% elseif collector.enabled %}
            not authenticated
        {% else %}
            disabled
        {% endif %}
    {% endset %}
    {% include 'WebProfilerBundle:Profiler:toolbar_item.html.twig' with { 'link': profiler_url } %}
{% endblock %}

{% block menu %}
<span class="label">
    <span class="icon"><img src="{{ asset('bundles/webprofiler/images/profiler/security.png') }}" alt="" /></span>
    <strong>Security</strong>
</span>
{% endblock %}

{% block panel %}
    <h2>Security</h2>
    {% if collector.user %}
        <table>
            <tr>
                <th>Username</th>
                <td>{{ collector.user }}</td>
            </tr>
            <tr>
                <th>Authenticated?</th>
                <td>
                    {% if collector.authenticated %}
                        yes
                    {% else %}
                        no {% if not collector.roles|length %}<em>(probably because the user has no roles)</em>{% endif %}
                    {% endif %}
                </td>
            </tr>
            <tr>
                <th>Roles</th>
                <td>{{ collector.roles|yaml_encode }}</td>
            </tr>
        </table>
    {% elseif collector.enabled %}
        <p>
            <em>No token</em>
        </p>
    {% else %}
        <p>
            <em>The security component is disabled</em>
        </p>
    {% endif %}
{% endblock %}
