I'm currently doing a class of symfony2, and the smallest thing I want in developp, I create a
- Display whether I want on my pages using roles (
IS_GRANTED user / role
managerI present In order to succeded>).
- My
is a link in the direction of the user / role
manager only when SUPER_ADMIN is logged. - Show all users, with their roles, user information (
username
,email
,roles
(each Use a Edit Button and a Form to display a text file for roles)
role_hierarchy: ROLE_ADMIN: ROLE_USER ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
<>
Then here is my roles in security.yml. P> When I
$ this-> Obtain ('security.role_hirarchy');
I get an object in which all my roles are I
I do not understand the things here:
In the database, I have created another with two users, a
), I see:created with ROLE_SUPER_ADMIN
,ROLE ADMIN
. When I remove them and display them on the screen (for role in {code> {{user.roles%} ... ...... {{role}} ..... { % Endfor%}- "ROLE_SUPER_ADMIN ROLE_USER" for my ROLE_SUPER_ADMIN - "ROLE_USER" for my ROLE administrator
-
Why? Because if I follow that logic (
ROLE_ADMIN = & gt; ROLE_USER
), then give meROLE_SUPER_ADMIN = & gt; ROLE_ADMIN
andROLE_ALLOWED_TO_SWITCH
, and thanks to the other relationship, that tooROLE_USER
. - One more thing, when I should be I am changing (in the editing page for the user) in a user's roles, what should I do to display the roles?
- ROLE_SUPER_ADMIN, ROLE_ADMIN
- ROLE_SUPER_ADMIN, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH, ROLE_USER
- ...?
I do not understand the connection between what is stored in the database and which is shown in the user's roles (jogging).
Thank you for your time.
Comments
Post a Comment