Symfony - Security / routing setup to enable password protected user pages -


i'm pretty new symfony although i've managed set working site, role based authentication , firewalls i'm struggling working out how build system allows users login , have access page , admin has access to.

what want dynamic security role enables user in current session access own private page , blocks else...

here's actual config:

 security:     encoders: #define encoders used encode passwords         symfony\component\security\core\user\user: plaintext         intuitbydesign\userbundle\entity\user: bcrypt     role_hierarchy:          role_admin: [role_user]      providers:         chain_provider:             chain:                  providers: [in_memory, user_db]          in_memory:              memory:                  users:                     admin: { password: adminpass, roles: role_admin }         user_db:              entity: {class: intuitbydesignuserbundle:user, property: username }         firewalls:         main:             logout: true             pattern: /.*              form_login:                  login_path: login                 check_path: login                  default_target_path: /user              logout:                 path: /logout                  target: /              security: true              anonymous: true      access_control:          - { path: /login, roles: is_authenticated_anonymously }          - { path: /logout, roles: is_authenticated_anonymously }         - { path: /user, roles: role_admin }          - { path: /user-page/,  roles: role_user}         - { path: /.*, roles: is_authenticated_anonymously }   

any hints on how this?

update: after login redirect page specific logged in user can see.

i thought way might achieved matching session username user path?

you check in redirected action, if user logged in. if yes, load data according user. e.g. load needed data user id.

so every user sees data related himself.

you can find more information user authentication handling in question: how check if user logged in symfony2 inside controller?


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -