mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-04 15:34:35 +02:00
Allow to disable a user in admin settings.
When a user is disabled, he can not login.
This commit is contained in:
parent
dd1dc54d97
commit
2187f5eac2
7 changed files with 216 additions and 2 deletions
|
@ -129,6 +129,7 @@ class UserAdminForm extends AbstractType
|
|||
'disabled' => !$this->security->isGranted('edit_infos', $entity),
|
||||
])
|
||||
|
||||
|
||||
//Config section
|
||||
->add('language', LanguageType::class, [
|
||||
'required' => false,
|
||||
|
@ -170,6 +171,7 @@ class UserAdminForm extends AbstractType
|
|||
'invalid_message' => 'password_must_match',
|
||||
'required' => false,
|
||||
'mapped' => false,
|
||||
'disabled' => !$this->security->isGranted('set_password', $entity),
|
||||
'constraints' => [new Length([
|
||||
'min' => 6,
|
||||
'max' => 128,
|
||||
|
@ -179,7 +181,17 @@ class UserAdminForm extends AbstractType
|
|||
->add('need_pw_change', CheckboxType::class, [
|
||||
'required' => false,
|
||||
'label_attr' => ['class' => 'checkbox-custom'],
|
||||
'label' => $this->trans->trans('user.edit.needs_pw_change')
|
||||
'label' => $this->trans->trans('user.edit.needs_pw_change'),
|
||||
'disabled' => !$this->security->isGranted('set_password', $entity)
|
||||
])
|
||||
|
||||
->add('disabled', CheckboxType::class, [
|
||||
'required' => false,
|
||||
'label_attr' => ['class' => 'checkbox-custom'],
|
||||
'label' => $this->trans->trans('user.edit.user_disabled'),
|
||||
'disabled' => !$this->security->isGranted('set_password', $entity)
|
||||
|| $entity === $this->security->getUser()
|
||||
|
||||
])
|
||||
|
||||
//Permission section
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue