security.html.twig 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. {% extends '@WebProfiler/Profiler/layout.html.twig' %}
  2. {% block page_title 'Security' %}
  3. {% block toolbar %}
  4. {% if collector.tokenClass %}
  5. {% set is_authenticated = collector.enabled and collector.authenticated %}
  6. {% set color_code = is_authenticated ? '' : 'yellow' %}
  7. {% else %}
  8. {% set color_code = collector.enabled ? 'red' : '' %}
  9. {% endif %}
  10. {% set icon %}
  11. {{ include('@Security/Collector/icon.svg') }}
  12. <span class="sf-toolbar-value">{{ collector.user|default('n/a') }}</span>
  13. {% endset %}
  14. {% set text %}
  15. {% if collector.tokenClass %}
  16. <div class="sf-toolbar-info-piece">
  17. <b>Logged in as</b>
  18. <span>{{ collector.user }}</span>
  19. </div>
  20. <div class="sf-toolbar-info-piece">
  21. <b>Authenticated</b>
  22. <span class="sf-toolbar-status sf-toolbar-status-{{ is_authenticated ? 'green' : 'red' }}">{{ is_authenticated ? 'Yes' : 'No' }}</span>
  23. </div>
  24. {% if collector.tokenClass != null %}
  25. <div class="sf-toolbar-info-piece">
  26. <b>Token class</b>
  27. <span>{{ collector.tokenClass|abbr_class }}</span>
  28. </div>
  29. {% endif %}
  30. {% if collector.logoutUrl %}
  31. <div class="sf-toolbar-info-piece">
  32. <b>Actions</b>
  33. <span><a href="{{ collector.logoutUrl }}">Logout</a></span>
  34. </div>
  35. {% endif %}
  36. {% elseif collector.enabled %}
  37. <div class="sf-toolbar-info-piece">
  38. <span>You are not authenticated.</span>
  39. </div>
  40. {% else %}
  41. <div class="sf-toolbar-info-piece">
  42. <span>The security is disabled.</span>
  43. </div>
  44. {% endif %}
  45. {% endset %}
  46. {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url, status: color_code }) }}
  47. {% endblock %}
  48. {% block menu %}
  49. <span class="label {{ not collector.enabled or not collector.tokenClass ? 'disabled' }}">
  50. <span class="icon">{{ include('@Security/Collector/icon.svg') }}</span>
  51. <strong>Security</strong>
  52. </span>
  53. {% endblock %}
  54. {% block panel %}
  55. <h2>Security Token</h2>
  56. {% if collector.tokenClass %}
  57. <div class="metrics">
  58. <div class="metric">
  59. <span class="value">{{ collector.user == 'anon.' ? 'Anonymous' : collector.user }}</span>
  60. <span class="label">Username</span>
  61. </div>
  62. <div class="metric">
  63. <span class="value">{{ include('@WebProfiler/Icon/' ~ (collector.authenticated ? 'yes' : 'no') ~ '.svg') }}</span>
  64. <span class="label">Authenticated</span>
  65. </div>
  66. </div>
  67. <table>
  68. <thead>
  69. <tr>
  70. <th scope="col" class="key">Property</th>
  71. <th scope="col">Value</th>
  72. </tr>
  73. </thead>
  74. <tbody>
  75. <tr>
  76. <th>Roles</th>
  77. <td>
  78. {{ collector.roles is empty ? 'none' : collector.roles|yaml_encode }}
  79. {% if not collector.authenticated and collector.roles is empty %}
  80. <p class="help">User is not authenticated probably because they have no roles.</p>
  81. {% endif %}
  82. </td>
  83. </tr>
  84. {% if collector.supportsRoleHierarchy %}
  85. <tr>
  86. <th>Inherited Roles</th>
  87. <td>{{ collector.inheritedRoles is empty ? 'none' : collector.inheritedRoles|yaml_encode }}</td>
  88. </tr>
  89. {% endif %}
  90. {% if collector.tokenClass %}
  91. <tr>
  92. <th>Token class</th>
  93. <td>{{ collector.tokenClass }}</td>
  94. </tr>
  95. {% endif %}
  96. </tbody>
  97. </table>
  98. {% elseif collector.enabled %}
  99. <div class="empty">
  100. <p>There is no security token.</p>
  101. </div>
  102. {% else %}
  103. <div class="empty">
  104. <p>The security component is disabled.</p>
  105. </div>
  106. {% endif %}
  107. {% endblock %}