Commit de7d78bffe93a53cd3e2fb341adef0a6300ec95d
1 parent
e40a9b34d4
Exists in
master
creada la verificacion del rol para permitir cambios en la inscripcion
Showing
2 changed files
with
22 additions
and
4 deletions
Show diff stats
src/AppBundle/Controller/InscripcionController.php
| @@ -105,7 +105,9 @@ class InscripcionController extends Controller | @@ -105,7 +105,9 @@ class InscripcionController extends Controller | ||
| 105 | $em = $this->getDoctrine()->getManager(); | 105 | $em = $this->getDoctrine()->getManager(); |
| 106 | $deleteForm = $this->createDeleteForm($inscripcion); | 106 | $deleteForm = $this->createDeleteForm($inscripcion); |
| 107 | $estado_academico = $em->getRepository('AppBundle:EstadoAcademico')->findOneByIdRolInstitucion($this->getUser()->getIdRolInstitucion()); | 107 | $estado_academico = $em->getRepository('AppBundle:EstadoAcademico')->findOneByIdRolInstitucion($this->getUser()->getIdRolInstitucion()); |
| 108 | - $editForm = $this->createForm('AppBundle\Form\InscripcionEditType', $inscripcion, array('oferta' => $inscripcion->getIdSeccion()->getOfertaAcademica()->getId())); | 108 | + |
| 109 | + $editForm = $this->createForm(new \AppBundle\Form\InscripcionEditType($this->get('security.context') | ||
| 110 | + ->isGranted('ROLE_COORDINADOR_REGIONAL')), $inscripcion, array('oferta' => $inscripcion->getIdSeccion()->getOfertaAcademica()->getId())); | ||
| 109 | $editForm->handleRequest($request); | 111 | $editForm->handleRequest($request); |
| 110 | 112 | ||
| 111 | if ($editForm->isSubmitted() && $editForm->isValid()) { | 113 | if ($editForm->isSubmitted() && $editForm->isValid()) { |
src/AppBundle/Form/InscripcionEditType.php
| @@ -10,6 +10,17 @@ use Doctrine\ORM\EntityRepository; | @@ -10,6 +10,17 @@ use Doctrine\ORM\EntityRepository; | ||
| 10 | 10 | ||
| 11 | class InscripcionEditType extends AbstractType | 11 | class InscripcionEditType extends AbstractType |
| 12 | { | 12 | { |
| 13 | + | ||
| 14 | + private $isGranted; | ||
| 15 | + | ||
| 16 | + public function __construct($roleFlag) | ||
| 17 | + { | ||
| 18 | + $this->isGranted = $roleFlag; | ||
| 19 | + //var_dump($this->isGranted); exit; | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + | ||
| 23 | + | ||
| 13 | /** | 24 | /** |
| 14 | * @param FormBuilderInterface $builder | 25 | * @param FormBuilderInterface $builder |
| 15 | * @param array $options | 26 | * @param array $options |
| @@ -28,10 +39,15 @@ class InscripcionEditType extends AbstractType | @@ -28,10 +39,15 @@ class InscripcionEditType extends AbstractType | ||
| 28 | )); | 39 | )); |
| 29 | 40 | ||
| 30 | }, | 41 | }, |
| 31 | - )) | ||
| 32 | - ->add('idEstatus') | 42 | + )); |
| 43 | + | ||
| 44 | + if($this->isGranted){ | ||
| 45 | + $builder->add('idEstatus'); | ||
| 46 | + } | ||
| 33 | 47 | ||
| 34 | - ; | 48 | + |
| 49 | + | ||
| 50 | + | ||
| 35 | } | 51 | } |
| 36 | 52 | ||
| 37 | /** | 53 | /** |