Hello,
Actually im working in a project with based symfony 2
authentication, we have implemented the required interfaces and
everything worked like a charm... the problem comes when we need to
access the current logged in user, the problem is that even with the
user logged in, symfony stills shows "not authenticated" as the
current user, its a really strange problem, first, because we have
configured the security for the routes of the applciation, for
example, we have ROLE_SUPER_ADMIN and ROLE_LOCAL_ADMIN, to change the
licences of a company for example, the logged user must have the super
admin role, and the role verifcation actually works perfectly, i will
post the most important code here, first, my security.yml looks like
this:
security:
encoders:
Cddoc\Dtr\BackEndBundle\Entity\User: plaintext
role_hierarchy:
ROLE_USER: ROLE_USER
ROLE_SUPER_USER: ROLE_SUPER_USER
ROLE_LOCAL_ADMIN: [ROLE_USER, ROLE_SUPER_USER]
ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_SUPER_USER,
ROLE_LOCAL_ADMIN]
providers:
#main provider (database access)
main:
entity: { class: CddocDtrBackEndBundle:User, property:
login}
firewalls:
## modified area for the security test in the application
secured_area:
pattern: ^/
anonymous: ~
form_login:
login_path: /login
check_path: /login_check
default_target_path: /loggedin
logout:
path: /logout
target: /loggedout
remember_me:
key: someS3cretKey
lifetime: 3600
path: /
domain: ~
access_control:
#Access control directives
- { path: /admin/.*, role: ROLE_LOCAL_ADMIN }
- { path: /company/.*, role: ROLE_SUPER_ADMIN }
- { path: /companyparameters/.*, role: ROLE_SUPER_ADMIN }
- { path: /licences/.*, role: ROLE_USER }
- { path: /group/.*, role: ROLE_SUPER_ADMIN }
- { path: /role/.*, role: ROLE_USER }
- { path: /role/.*, role: ROLE_SUPER_ADMIN }
- { path: /user/.*, role: ROLE_SUPER_ADMIN }
in my user class, the difference is that i dont have a direct
connection with the groups table, so, i need to get it from another
entity, this is what i do in this case:
public function getRoles() {
$rolesList = $this->getGroup()->getRole();
$rolesArray = array();
foreach ($rolesList as $role) {
array_push($rolesArray, $role->getProfile()-
>__toString());
}
return $rolesArray;
}
but it seems to be ok, cause actually the verification of routes work,
so wheres the problem? why symfony dont shows me the actually logged
user? thank you in advance for your time!
Best Regards
André Martins
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en