How can I secure actions with locale - this was pretty easy in symfony1.4. I use now symfony2.3:
My security.yml:
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
login:
pattern: frontend_account_login
security: false
secured_area:
pattern: ^/
anonymous: ~
http_basic:
realm: "Secured Demo Area"
form_login:
check_path: frontend_account_security_check
login_path: frontend_account_login
use_referer: true
default_target_path: frontend_account_hello
logout:
path: /logout
target: frontend_account_login #anonymous: ~
#http_basic:
# realm: "Secured Demo Area"
access_control:
#This works:
- { path: ^/de/account/secured/, roles: ROLE_ADMIN }
- { path: ^/en/account/secured/, roles: ROLE_ADMIN }
#I want it kind of that way
- { path: ^/{_locale}/account/secured/, roles: ROLE_ADMIN }
I read a post with regex: ^/[a-z]+/account/secured/. But it doesn't work. Any idea how I can secure areas with locale. I found some posts here but they all don't work.
Thanks!!!
If you have only two locales:
- { path: ^/(en|de)/account/secured/, roles: ROLE_ADMIN }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With