src/Controller/DefaultController.php line 25

  1. <?php
  2. namespace App\Controller;
  3. use Doctrine\Persistence\ManagerRegistry;
  4. use Symfony\Component\HttpFoundation\Response;
  5. use Symfony\Component\Routing\Annotation\Route;
  6. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  7. use Symfony\Component\Security\Core\Security as CoreSecurity;
  8. class DefaultController extends AbstractController
  9. {
  10.     protected $security;
  11.     public function __construct(CoreSecurity $security)
  12.     {
  13.         $this->security $security;
  14.     }
  15.     /**
  16.      * @Route("/", name="home")
  17.      */
  18.     public function index()
  19.     {
  20.         if ($this->security->isGranted('ROLE_ADMIN')) {
  21.             return $this->redirectToRoute('browser');
  22.         } elseif ($this->security->isGranted('ROLE_USER')) {
  23.             return $this->redirectToRoute('timetrackerVue');
  24.         } else {
  25.             return $this->redirectToRoute('login');
  26.         }
  27.     }
  28.     /**
  29.      * @Route("/dropzone")
  30.      */
  31.     public function dropzone()
  32.     {
  33.         return $this->render('browser/dropzone.vue.html.twig', [
  34.             'controller_name' => 'browser',
  35.         ]);
  36.     }
  37.     /**
  38.      * @Route("/ldap")
  39.      */
  40.     public function ldap()
  41.     {
  42.         return $this->render('base.html.twig', [
  43.             'controller_name' => 'ldap',
  44.         ]);
  45.     }
  46. }