I\'m building this user manager, where admins can change permission of a group or user. I don\'t want to use the FOS user bundle, because I want to customize alot.
I fou
You can check if the current user has a role by twig by using the function is_granted
{% if is_granted('ROLE_USER') %}
{{ app.user.username }}
{% endif %}
Getting the current users roles array in twig:
{{ app.user.roles }}
If you are wanting to display from a collection of users, you can do something like this (assuming collection passed as users)
{% for user in users %}
{{ user.username }}:
{% for role in user.roles %}
{{ role }}
{% endfor %}
{% endfor %}