70 likes | 199 Vues
In Week 3 of our Symfony2 blog application tutorial, we focus on the UserBundle's advanced features including authentication and authorization. You will learn how to implement user management, set up a service to log user actions, and handle events effectively. Key requirements include adding a User entity, CRUD operations for users, managing login/logout functionality, controlling access by roles, and configuring services using YML. Additionally, we will explore event listeners to automatically handle entity states and track blog page hits, enhancing the application's interactivity.
E N D
Symfony2 - Step-by-step • Week 3 • UserBundle • Authentication • Authorization • Events • Services
Week 3 – Symfony2 Advanced • Purpose: blog application • Requirements: • User management • Authorization • Authentication • Services • Events
1 – UserBundle • Requirements: • Add LikipeUserBundle • Add User entity • Add C.R.U.D. for User • Tutorial: http://symfony.com/doc/current/book/doctrine.html
2 – Authentication • Requirements: • Login/logout with User entity • UserProvider • Tutorial: http://symfony.com/doc/current/cookbook/security/entity_provider.html • Achievement: • UserInterface • Note: • Password need to be encoded
3 – Authorization • Requirements: • Only ROLE_USER can see routes from LikipeBlogBundle • Only ROLE_ADMIN can see routes from LikipeUserBundle • Tutorial: http://symfony.com/doc/current/cookbook/security/entity_provider.html#authenticating-someone-against-a-database • Achievement: • User’s roles • Access control by Role • Note: • Must use security.yml configuration
3 – Services • Requirements: • Create a service “likipe_log” (in LikipeBlogBundle) • “likipe_log” will save messages in /web/likipe.log file • Tutorial: http://symfony.com/doc/current/book/service_container.html • Achievement: • Service configuration • Service terminology • Note: • Must use “bundle” service.yml configuration
4 – Events • Requirements: • Auto-add “created” for entities before persits • Page hits for blog page. • Tutorial: • http://symfony.com/doc/current/cookbook/doctrine/event_listeners_subscribers.html • http://symfony.com/doc/current/components/event_dispatcher/introduction.html • Achievement: • Listener on Doctrine • Listener on Kernel