mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-14 20:35:08 +02:00
Prevent a user from lock itself out from the user system.
This commit is contained in:
parent
856e20586f
commit
90d449ea22
6 changed files with 164 additions and 1 deletions
|
@ -33,10 +33,12 @@ namespace App\Form\Permissions;
|
|||
|
||||
|
||||
use App\Services\PermissionResolver;
|
||||
use App\Validator\Constraints\NoLockout;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\Form\FormView;
|
||||
use Symfony\Component\OptionsResolver\Options;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class PermissionsType extends AbstractType
|
||||
|
@ -54,8 +56,16 @@ class PermissionsType extends AbstractType
|
|||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'show_legend' => true
|
||||
'show_legend' => true,
|
||||
'constraints' => function (Options $options) {
|
||||
if (!$options['disabled']) {
|
||||
return [new NoLockout()];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function buildView(FormView $view, FormInterface $form, array $options)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue