Jon
Jon

Reputation: 11

symfony 1.4 - redirection in security.yml

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.

Upvotes: 1

Views: 191

Answers (1)

davidvegacl
davidvegacl

Reputation: 151

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 ]

Upvotes: 2

Related Questions