Commit a6678a3d8852ea41132f87e082f19ba48805bf77

Authored by Wilmer Ramones
1 parent bcf7054a41
Exists in master

preguntar primero si no tiene rol docente y luego incluirlo

src/AppBundle/Controller/SeccionController.php
... ... @@ -49,7 +49,9 @@ class SeccionController extends Controller
49 49 $em = $this->getDoctrine()->getManager();
50 50  
51 51 $user = $this->getDoctrine()->getRepository('AppBundle:Usuarios')->findOneByIdRolInstitucion($this->getUser()->getIdRolInstitucion());
52   - $user->addRol($this->getDoctrine()->getRepository('AppBundle:Role')->findOneByName("ROLE_DOCENTE"));
  52 + if (false === $this->get('security.authorization_checker')->isGranted('ROLE_DOCENTE')) {
  53 + $user->addRol($this->getDoctrine()->getRepository('AppBundle:Role')->findOneByName("ROLE_DOCENTE"));
  54 + }
53 55  
54 56 $em->persist($user);
55 57 $em->persist($seccion);
... ...