piotrekkr
piotrekkr

Reputation: 3226

Symfony2 access controll and path names

I could not find this in symfony2 docs so I'm asking here. Is it possible to set path names instead of patterns inside security.yml access_controll?

Instead of:

access_control:
    - { path: /admin/logowanie, roles: IS_AUTHENTICATED_ANONYMOUSLY }

set it like this:

access_control:
    - { path: pkr_blog_user_login, roles: IS_AUTHENTICATED_ANONYMOUSLY }

Path name is correct but at the moment second form does not work . How can I make it work?

Upvotes: 0

Views: 359

Answers (1)

DonCallisto
DonCallisto

Reputation: 29932

I don't think that you can do something like this.

What you can do is to secure a controller that is pretty much like what you're trying to do here, as a controller (action) will be invoked by a particular route and even if you change route name, is supposed that you have to pass through the same controller action.

In that way you can have the flexibility that you're searching for.

Upvotes: 1

Related Questions