How to redirect a user to a page depending on the role.
For example:
There is a module hello_world, and it has an action index (it prints the text "Hello World")
There is a module user, and in it there is action userList.
The administrator can view all these actions. User can only view the hello_world page.
How to do this with security.yml files.
You can define security credentials for each module. If the user doesn't need a credential, then
/.../modules/hello_world/config/security.yml
all:
is_secure: false
And
/.../modules/user/config/security.yml
all:
is_secure: true
credentials: [ admin ]
userList:
credentials: [ SOME_SPECIFIC_CREDENTIALS_FOR_ACTION ]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.