As title said I need to modify sfDoctrineGuard validators to allow login based on credentials. I've this users and credentials:
username credential
administrator super admin
user1 public_access
user2
user3 public_access
I've also two applications: admin and site. So based on this data I need to achieve this:
- user1 and user3 could login in site app but not in admin
- user2 couldn't login in site and either in admin
- administrator could login in admin but not in site
Any help?
First you should copy the
sfGuardValidatorUserclass fromplugins/sfDoctrineGuardPlugin/lib/validatorintolib/validatorand clear the cache.Than modify it's
doCleanmethod to check if a user has the required permission.Than add
isAllowedToLogInmethod to thesfGuardUserclass:Modify the permission check part if needed.
I recommend to add an admin group and permission as well and if you can don't use the
is_super_adminflag.