Commit 05609179 by Yvon

role adherent is not allowed to change nom prenom anymore

parent a7029d2a
...@@ -10,14 +10,17 @@ use Symfony\Component\Form\Extension\Core\Type\EmailType; ...@@ -10,14 +10,17 @@ use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Security\Core\Security;
class UserInfosFormType extends AbstractType class UserInfosFormType extends AbstractType
{ {
protected $em; protected $em;
protected $security;
public function __construct(EntityManagerInterface $em) public function __construct(EntityManagerInterface $em, Security $security)
{ {
$this->em = $em; $this->em = $em;
$this->security = $security;
} }
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
...@@ -27,10 +30,12 @@ class UserInfosFormType extends AbstractType ...@@ -27,10 +30,12 @@ class UserInfosFormType extends AbstractType
->add('firstname', TextType::class, [ ->add('firstname', TextType::class, [
'label' => 'Prénom', 'label' => 'Prénom',
'required' => false, 'required' => false,
'disabled' => $this->security->isGranted('ROLE_ADHERENT'),
]) ])
->add('lastname', TextType::class, [ ->add('lastname', TextType::class, [
'label' => 'Nom', 'label' => 'Nom',
'required' => false, 'required' => false,
'disabled' => $this->security->isGranted('ROLE_ADHERENT'),
]) ])
->add('email', EmailType::class, [ ->add('email', EmailType::class, [
'label' => 'Courriel', 'label' => 'Courriel',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment