Chciałbym zapytać w jaki sposób ustawić przekierowanie po zalogowaniu się w zależności czy to zwykły użytkownik czy admin.
Chciałbym abyw zależności od rodzaju użytkownika przekierowywało mnie na odpowiednią zakładkę.
Na tą chwilę mój plik security wygląda tak:
# you can read more about security in the related section of the documentation # <a href="http://symfony.com/doc/current/book/security.html" target="_blank">http://symfony.com/doc/current/book/security.html</a> security: # <a href="http://symfony.com/doc/current/book/security.html#encoding-the-user-s-password" target="_blank">http://symfony.com/doc/current/book/securi...user-s-password</a> encoders: User\ProfileBundle\Entity\User: algorithm: bcrypt cost: 15 # <a href="http://symfony.com/doc/current/book/security.html#hierarchical-roles" target="_blank">http://symfony.com/doc/current/book/securi...rarchical-roles</a> role_hierarchy: ROLE_ADMIN: ROLE_USER ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH] # <a href="http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers" target="_blank">http://symfony.com/doc/current/book/securi...-user-providers</a> providers: main: entity: class: User\ProfileBundle\Entity\User property: username in_memory: memory: users: user: { password: userpass, roles: [ 'ROLE_USER' ] } admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] } # the main part of the security, where you can set up firewalls # for specific sections of your app firewalls: # disables authentication for assets and the profiler, adapt it according to your needs dev: pattern: ^/(_(profiler|wdt)|css|images|js)/ security: false # the login page has to be accessible for everybody demo_login: pattern: ^/demo/secured/login$ security: false # secures part of the application demo_secured_area: pattern: ^/demo/secured/ # it's important to notice that in this case _demo_security_check and _demo_login # are route names and that they are specified in the AcmeDemoBundle form_login: check_path: _demo_security_check login_path: _demo_login logout: path: _demo_logout target: _demo #anonymous: ~ #http_basic: # realm: "Secured Demo Area" secured_area: pattern: ^/ anonymous: ~ form_login: always_use_default_target_path: true default_target_path: /index login_path: login check_path: login_check logout: path: /logout target: /login # with these settings you can restrict or allow access for different parts # of your application based on roles, ip, host or methods # <a href="http://symfony.com/doc/current/book/security.html#security-book-access-control-matching-options" target="_blank">http://symfony.com/doc/current/book/securi...atching-options</a> access_control: #- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https } - { path: ^/after_login, roles: ROLE_USER } #- { path: ^/index, roles: ROLE_USER } - {path: ^/index,roles: ROLE_SUPER_ADMIN }