I learned Symfony2 recently and I have created a small application with it. It works fine till now.
I have created a user module where i register a user. and then that user can login to access the application. I am using the SESSION as well to carry the user object from one page to another. I have not yet done any sort of authentication that will check if the user session is active and that is the reason when I enter a url manually it takes me to the page without checking if i have logged in or not.
Also I want to have different user with different access roles. i,e I don’t want to give all access to all users. Some users should have limited access.
Can anyone tell me :
- what is the best way to do this.
- How can i redirect every url entered, to login page unless user is logged in
- I would also like to have some tutorials regarding the same.
The FOSUserBundle is very useful for everything related to user management, and it’s very popular too, you should look into it: https://github.com/FriendsOfSymfony/FOSUserBundle
Check-out the documentation here: https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/index.md