Commit a6678a3d8852ea41132f87e082f19ba48805bf77
1 parent
bcf7054a41
Exists in
master
preguntar primero si no tiene rol docente y luego incluirlo
Showing
1 changed file
with
3 additions
and
1 deletions
Show diff stats
src/AppBundle/Controller/SeccionController.php
@@ -49,7 +49,9 @@ class SeccionController extends Controller | @@ -49,7 +49,9 @@ class SeccionController extends Controller | ||
49 | $em = $this->getDoctrine()->getManager(); | 49 | $em = $this->getDoctrine()->getManager(); |
50 | 50 | ||
51 | $user = $this->getDoctrine()->getRepository('AppBundle:Usuarios')->findOneByIdRolInstitucion($this->getUser()->getIdRolInstitucion()); | 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 | $em->persist($user); | 56 | $em->persist($user); |
55 | $em->persist($seccion); | 57 | $em->persist($seccion); |