ClankBundle
ClankBundle copied to clipboard
Security.context issue in RPCs
Hi.
I'm working around with the RPCs, and when I try to inject the security context and recover the current user, this is null
I've tried in a bunch of different ways, but I'm always back to the same point... someone was able to do this? Any idea?
Thanks.
Hi there! I have solved it by getting the session info, unserializing and getting the user:
private function getCurrentUser(Connection $connection) {
$securityMain = $connection->Session->get('_security_main');
if($securityMain) {
$securityMain = unserialize($securityMain);
$user = $securityMain->getUser();
return $user;
}
return null;
}
Hope it helps ;)
Wow that could do the trick!
Thanks!
@NaxYo thank you very much!