mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-03-06 15:30:13 +01:00
Allow to disable a user in admin settings.
When a user is disabled, he can not login.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user