|
@@ -84,19 +84,32 @@ file that was distributed with this source code.
|
|
|
</a>
|
|
|
{% endblock %}
|
|
|
<ul class="nav">
|
|
|
+
|
|
|
{% block sonata_top_bar_nav %}
|
|
|
- {% for group in admin_pool.dashboardgroups %}
|
|
|
- <li class="dropdown">
|
|
|
- <a href="#" class="dropdown-toggle">{{ group.label|trans({}, group.label_catalogue) }}</a>
|
|
|
- <ul class="dropdown-menu">
|
|
|
- {% for admin in group.items %}
|
|
|
- {% if admin.hasroute('create') and admin.isGranted('CREATE') or admin.hasroute('list') and admin.isGranted('LIST') %}
|
|
|
- <li><a href="{{ admin.generateUrl('list')}}">{{ admin.label|trans({}, admin.translationdomain) }}</a></li>
|
|
|
- {% endif %}
|
|
|
- {% endfor %}
|
|
|
- </ul>
|
|
|
- </li>
|
|
|
- {% endfor %}
|
|
|
+ {# There is no hasRole in a TokenInterface ... #}
|
|
|
+ {% set allowed = false %}
|
|
|
+ {% if app.security %}
|
|
|
+ {% for role in app.security.token.roles %}
|
|
|
+ {% if not allowed %}
|
|
|
+ {% set allowed = role.role == 'ROLE_SONATA_ADMIN' %}
|
|
|
+ {% endif %}
|
|
|
+ {% endfor %}
|
|
|
+ {% endif %}
|
|
|
+
|
|
|
+ {% if allowed %}
|
|
|
+ {% for group in admin_pool.dashboardgroups %}
|
|
|
+ <li class="dropdown">
|
|
|
+ <a href="#" class="dropdown-toggle">{{ group.label|trans({}, group.label_catalogue) }}</a>
|
|
|
+ <ul class="dropdown-menu">
|
|
|
+ {% for admin in group.items %}
|
|
|
+ {% if admin.hasroute('create') and admin.isGranted('CREATE') or admin.hasroute('list') and admin.isGranted('LIST') %}
|
|
|
+ <li><a href="{{ admin.generateUrl('list')}}">{{ admin.label|trans({}, admin.translationdomain) }}</a></li>
|
|
|
+ {% endif %}
|
|
|
+ {% endfor %}
|
|
|
+ </ul>
|
|
|
+ </li>
|
|
|
+ {% endfor %}
|
|
|
+ {% endif %}
|
|
|
{% endblock %}
|
|
|
</ul>
|
|
|
|