1

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.

svgrafov
  • 1,970
  • 4
  • 16
  • 32
Jon
  • 11
  • 1
  • 1
    Hi! Welcome to StackOverflow. Please check [link](https://stackoverflow.com/help/how-to-ask) on how to ask a question. – Nick Nov 30 '17 at 22:16

1 Answers1

2

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 ]
davidvegacl
  • 141
  • 1
  • 5