Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private function getVariables(GuardEvent $event)
- {
- $token = $this->tokenStorage->getToken();
- if (null === $token) {
- throw new \Exception("No token is set")
- }
- if (null !== $this->roleHierarchy) {
- $roles = $this->roleHierarchy->getReachableRoles($token->getRoles());
- } else {
- $roles = $token->getRoles();
- }
- $variables = array(
- 'token' => $token,
- 'user' => $token->getUser(),
- 'subject' => $event->getSubject(),
- 'roles' => array_map(function ($role) {
- return $role->getRole();
- }, $roles),
- // needed for the is_granted expression function
- 'auth_checker' => $this->authenticationChecker,
- // needed for the is_* expression function
- 'trust_resolver' => $this->trustResolver,
- );
- return $variables;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement