RudySkate
RudySkate

Reputation: 51

role hierarchy inheritance - Symfony2

I've problem with my hierarchical role in security.yml

role_hierarchy

    ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
    ROLE_ADMIN: [ROLE_PILOT, ROLE_EXPERT]
    ROLE_PILOT: ROLE_PRODIVER
    ROLE_PROVIDER: ROLE_PROVIDER_EXTERNAL
    ROLE_PROVIDER_EXTERNAL: ROLE_USER

When i'm using *is_granted* in TWIG :

{% if is_granted('ROLE_PROVIDER_EXTERNAL') %}
 <li class="dropdown">[...]</li>
{% endif %}

Normally the ROLE_PILOT should be able to view this HTML element with the inheritance of roles. But if user is connected in ROLE_PILOT, HTML element cannot display for him...

Anyone have an idea for my problem ?
Thx

Upvotes: 1

Views: 1720

Answers (1)

KFCSpike
KFCSpike

Reputation: 90

Your code shows:

ROLE_PILOT: ROLE_PRODIVER

Try changing it to:

ROLE_PILOT: ROLE_PROVIDER

Upvotes: 2

Related Questions