I'm developing a Symfony1 app and I'm using sfDoctrineGuard plugin, all is configured and working fine! But I've a problem, I created 3 users:
username group_name
administrador super_administrator
user1 group1
user2 -
I've also two apps site and admin. User administrator can login and access every content at admin side others like user1 and user2 can't. user1 and every users belongs to group1 can login at site frontend, user2 and users without group1 assigned can't. I tried securing the module dashboard which is the entry point for site app in this way:
default:
is_secure: true
credentials: group1
But it's not working I get always this message:
Oops! The page you asked for is secure and you do not have proper credentials.
How can I do this? What I'm doing wrong?
sfDoctrineGuard
converts permissions
to credentials so you should create permissions like group1 (or something more meaningful) and assing them to users or groups. sfDoctrineGuard
will aggregate group and user permissions. This way you can use a permission name everywhere you need a credential. If you would like to disallow login for specific permissions you should override sfGuardValidatorUser
or sfGuardSecurityUser::signIn
and use $user->hasPermission('group1')
to check for a user has a required permission.