Friday 15 August 2014

php - Protect a directory in Symfony2 -



php - Protect a directory in Symfony2 -

i need help secure repository. united nations website, have sonataadminbundle + fosuserbundle.

after loggin me on sonata admin page (/admin), want connected user id in other page (/test).

my controller :

class ckeditorcontroller extends controller { public function indexaction() { # how user id ? } }

best regards,

you can try

$this->getuser()->getid()

which shortcut

$user = $this->get('security.context')->gettoken()->getuser()->getid();

see documentation

php symfony2 fosuserbundle

No comments:

Post a Comment