Created
May 13, 2015 14:07
-
-
Save 0xPr0xy/079d5d79f6de86854327 to your computer and use it in GitHub Desktop.
service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param ContainerInterface $container The Container | |
* @param Request $request The Request | |
* @param RenderContext $context The Render context | |
* | |
* @return void|RedirectResponse | |
*/ | |
public function service(ContainerInterface $container, Request $request, RenderContext $context) | |
{ | |
$security = $container->get('security.context'); | |
$user = $security->getToken()->getUser(); | |
$hasUserRole = $security->isGranted('ROLE_USER'); | |
if($user && $hasUserRole){ | |
$context['user'] = $user; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment