diff --git a/phpstan-deprecations.neon b/phpstan-deprecations.neon index 2de8b8bc8..42981a551 100644 --- a/phpstan-deprecations.neon +++ b/phpstan-deprecations.neon @@ -471,11 +471,6 @@ parameters: count: 1 path: src/Bundle/ChillMainBundle/Form/Type/UserPickerType.php - - - message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" - count: 1 - path: src/Bundle/ChillMainBundle/Form/UserType.php - - message: "#^Only booleans are allowed in an if condition, mixed given\\.$#" count: 2 diff --git a/src/Bundle/ChillMainBundle/Controller/UserController.php b/src/Bundle/ChillMainBundle/Controller/UserController.php index 4eb22c5d3..b6ded6653 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserController.php @@ -344,6 +344,11 @@ class UserController extends CRUDController ), ] ); + } elseif ('index' === $action) { + return array_merge( + ['allow_change_password' => $this->parameterBag->get('chill_main.access_user_change_password')], + $defaultTemplateParameters + ); } // default behaviour diff --git a/src/Bundle/ChillMainBundle/Form/UserType.php b/src/Bundle/ChillMainBundle/Form/UserType.php index 9e7da7a89..34c49bc38 100644 --- a/src/Bundle/ChillMainBundle/Form/UserType.php +++ b/src/Bundle/ChillMainBundle/Form/UserType.php @@ -112,6 +112,7 @@ class UserType extends AbstractType }, ]); + // @phpstan-ignore-next-line if ($options['is_creation'] && $this->parameterBag->get('chill_main.access_user_change_password')) { $builder->add('plainPassword', RepeatedType::class, [ 'mapped' => false, diff --git a/src/Bundle/ChillMainBundle/Resources/views/User/index.html.twig b/src/Bundle/ChillMainBundle/Resources/views/User/index.html.twig index 1d254abb9..ec93cf8a7 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/User/index.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/User/index.html.twig @@ -50,9 +50,13 @@
  • + + {% if allow_change_password is same as(true) %}
  • + {% endif %} + {% if is_granted('ROLE_ALLOWED_TO_SWITCH') %}