| Conditions | 2 |
| Paths | 2 |
| Total Lines | 20 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | public function Index(Application $app) { |
||
| 11 | $isAuthenticated = false; |
||
| 12 | $roles = array(); |
||
| 13 | |||
| 14 | //Leaving this here as we also grab roles below, but LoginUserService->GetCurrentUser() will fetch user via this method too: |
||
| 15 | $token = $app['security']->getToken(); |
||
| 16 | |||
| 17 | if ($token !== null) { |
||
| 18 | $usr = $token->getUser(); |
||
| 19 | |||
| 20 | $isAuthenticated = true; |
||
| 21 | $roles = $usr->getRoles(); |
||
| 22 | } |
||
| 23 | |||
| 24 | $response = array( |
||
| 25 | "authenticated" => $isAuthenticated, |
||
| 26 | "roles" => $roles |
||
| 27 | ); |
||
| 28 | |||
| 29 | return $app->json($response, Response::HTTP_OK); |
||
| 30 | } |
||
| 31 | } |