From a6678a3d8852ea41132f87e082f19ba48805bf77 Mon Sep 17 00:00:00 2001 From: Wilmer Ramones Date: Mon, 25 Jul 2016 16:00:49 -0400 Subject: [PATCH] preguntar primero si no tiene rol docente y luego incluirlo --- src/AppBundle/Controller/SeccionController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/AppBundle/Controller/SeccionController.php b/src/AppBundle/Controller/SeccionController.php index 7de7b5d..1c17f13 100644 --- a/src/AppBundle/Controller/SeccionController.php +++ b/src/AppBundle/Controller/SeccionController.php @@ -49,7 +49,9 @@ class SeccionController extends Controller $em = $this->getDoctrine()->getManager(); $user = $this->getDoctrine()->getRepository('AppBundle:Usuarios')->findOneByIdRolInstitucion($this->getUser()->getIdRolInstitucion()); - $user->addRol($this->getDoctrine()->getRepository('AppBundle:Role')->findOneByName("ROLE_DOCENTE")); + if (false === $this->get('security.authorization_checker')->isGranted('ROLE_DOCENTE')) { + $user->addRol($this->getDoctrine()->getRepository('AppBundle:Role')->findOneByName("ROLE_DOCENTE")); + } $em->persist($user); $em->persist($seccion); -- 2.0.0