fix strict typing and do not show link to edit password in user list

This commit is contained in:
Julien Fastré 2022-05-27 16:24:55 +02:00
parent 566c1c5380
commit 7278a5f3fa
4 changed files with 10 additions and 5 deletions

View File

@ -471,11 +471,6 @@ parameters:
count: 1 count: 1
path: src/Bundle/ChillMainBundle/Form/Type/UserPickerType.php 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\\.$#" message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
count: 2 count: 2

View File

@ -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 // default behaviour

View File

@ -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')) { if ($options['is_creation'] && $this->parameterBag->get('chill_main.access_user_change_password')) {
$builder->add('plainPassword', RepeatedType::class, [ $builder->add('plainPassword', RepeatedType::class, [
'mapped' => false, 'mapped' => false,

View File

@ -50,9 +50,13 @@
<li> <li>
<a class="btn btn-edit" href="{{ path('chill_crud_admin_user_edit', { 'id': entity.id }) }}"></a> <a class="btn btn-edit" href="{{ path('chill_crud_admin_user_edit', { 'id': entity.id }) }}"></a>
</li> </li>
{% if allow_change_password is same as(true) %}
<li> <li>
<a class="btn btn-chill-red" href="{{ path('admin_user_edit_password', { 'id' : entity.id }) }}" title="{{ 'Edit password'|trans|e('html_attr') }}"><i class="fa fa-ellipsis-h"></i></a> <a class="btn btn-chill-red" href="{{ path('admin_user_edit_password', { 'id' : entity.id }) }}" title="{{ 'Edit password'|trans|e('html_attr') }}"><i class="fa fa-ellipsis-h"></i></a>
</li> </li>
{% endif %}
{% if is_granted('ROLE_ALLOWED_TO_SWITCH') %} {% if is_granted('ROLE_ALLOWED_TO_SWITCH') %}
<li> <li>
<a class="btn btn-chill-blue" href="{{ path('chill_main_homepage', {'_switch_user': entity.username }) }}" title="{{ "Impersonate"|trans|e('html_attr') }}"><i class="fa fa-user-secret"></i></a> <a class="btn btn-chill-blue" href="{{ path('chill_main_homepage', {'_switch_user': entity.username }) }}" title="{{ "Impersonate"|trans|e('html_attr') }}"><i class="fa fa-user-secret"></i></a>